use schemars::JsonSchema;
use serde::Serialize;
#[derive(Debug, Serialize, JsonSchema)]
#[schemars(rename = "AgentAccountCreatedSchema")]
pub struct AgentAccountCreatedOutput {
pub output_kind: &'static str,
pub account_id: String,
pub pet_name: String,
pub subject: String,
pub authenticated: bool,
pub credential_saved: bool,
pub next: HumanPromotionDirective,
}
#[derive(Debug, Serialize, JsonSchema)]
pub struct HumanPromotionDirective {
pub kind: &'static str,
pub summary: &'static str,
pub account_id: String,
pub command: &'static str,
pub promotion_uri: Option<String>,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, JsonSchema)]
#[serde(rename_all = "lowercase")]
pub enum DescriptorTrustSource {
Explicit,
Automatic,
}
#[derive(Serialize, JsonSchema)]
#[schemars(rename = "AuthLogoutSchema")]
pub struct AuthLogoutOutput {
pub output_kind: &'static str,
pub server: String,
pub removed: bool,
pub device_identity_removed: bool,
}
#[derive(Serialize, JsonSchema)]
#[schemars(rename = "AuthStatusSchema")]
pub struct AuthStatusOutput {
pub output_kind: &'static str,
pub server: String,
pub authenticated: bool,
pub source: String,
pub proof_key_available: bool,
pub subject: Option<String>,
pub credential_id: Option<String>,
pub expires_at: Option<String>,
pub recommended_action: Option<String>,
}
#[derive(Serialize, JsonSchema)]
#[schemars(rename = "AuthTrustSchema")]
pub struct AuthTrustOutput {
pub output_kind: &'static str,
pub canonical_server: String,
pub source: DescriptorTrustSource,
pub key_id: String,
pub public_key: String,
pub fingerprint: String,
}
#[derive(Serialize, JsonSchema)]
#[schemars(rename = "AuthCreateServiceTokenSchema")]
pub struct ServiceTokenOutput {
pub output_kind: &'static str,
pub name: String,
pub namespace: String,
pub scope: String,
pub credential_path: String,
pub expires_in_days: u32,
}
#[derive(Serialize, JsonSchema)]
#[schemars(rename = "AuthSignupInviteCreatedSchema")]
pub struct SignupInviteCreatedOutput {
pub output_kind: &'static str,
pub invite_id: String,
pub invite_code: String,
pub allowance_remaining: u32,
}
#[derive(Serialize, JsonSchema)]
#[schemars(rename = "AuthSignupInviteSchema")]
pub struct SignupInviteOutput {
pub invite_code: String,
pub status: String,
pub created_at: Option<String>,
pub consumed: bool,
pub consumed_at: Option<String>,
}
#[derive(Serialize, JsonSchema)]
#[schemars(rename = "AuthSignupInviteListSchema")]
pub struct SignupInviteListOutput {
pub output_kind: &'static str,
pub invites: Vec<SignupInviteOutput>,
pub allowance_remaining: u32,
}
#[derive(Debug, Clone, Serialize, JsonSchema)]
#[schemars(rename = "WhoamiCaptureActorSchema")]
pub struct CaptureActor {
pub name: String,
pub email: String,
pub source: Option<&'static str>,
}
#[derive(Debug, Serialize, JsonSchema)]
#[schemars(rename = "WhoamiSchema")]
pub struct WhoamiOutput {
pub output_kind: &'static str,
pub capture_actor: CaptureActor,
pub server: String,
pub authenticated: bool,
pub source: String,
pub subject: Option<String>,
pub reachable: bool,
pub token_kind: Option<String>,
pub scopes: Vec<String>,
pub operation_ceiling: Option<Vec<String>>,
pub expires_at: Option<String>,
pub ttl_seconds_remaining: Option<i64>,
pub proof_key_available: bool,
pub identity: Option<WhoamiIdentity>,
pub recommended_action: Option<String>,
}
#[derive(Debug, Serialize, JsonSchema)]
#[schemars(rename = "WhoamiIdentitySchema")]
pub struct WhoamiIdentity {
pub subject: String,
pub actor_subject: String,
pub is_staff: bool,
pub is_service_account: bool,
pub is_biscuit: bool,
pub session_id: String,
pub amr: Vec<String>,
pub server_scope: String,
pub credential_id: String,
pub device_id: Option<String>,
pub agent_provider: Option<String>,
pub agent_model: Option<String>,
pub roles: Vec<WhoamiRole>,
}
#[derive(Debug, Serialize, JsonSchema)]
#[schemars(rename = "WhoamiRoleSchema")]
pub struct WhoamiRole {
pub resource_path: String,
pub resource_kind: String,
pub role: String,
}