use schemars::JsonSchema;
use serde::Serialize;
#[derive(Debug, Serialize, JsonSchema)]
#[schemars(rename = "PromoteSchema")]
pub struct PromoteOutput {
pub output_kind: &'static str,
pub status: &'static str,
pub from: String,
pub full_path: String,
pub spool_id: String,
pub is_repo: bool,
pub server: String,
pub recommended_action: Option<String>,
}
#[derive(Debug, Serialize, JsonSchema)]
#[schemars(rename = "GrantCreateSchema")]
pub struct GrantCreateOutput {
pub output_kind: &'static str,
pub id: String,
pub principal: String,
pub role: String,
pub spool: String,
pub server: String,
pub recommended_action: Option<String>,
}
#[derive(Debug, Serialize, JsonSchema)]
#[schemars(rename = "GrantRowSchema")]
pub struct GrantRowOutput {
pub id: String,
pub principal: String,
pub role: String,
pub spool: String,
}
#[derive(Debug, Serialize, JsonSchema)]
#[schemars(rename = "GrantListSchema")]
pub struct GrantListOutput {
pub output_kind: &'static str,
pub spool: String,
pub server: String,
pub grants: Vec<GrantRowOutput>,
pub recommended_action: Option<String>,
}
#[derive(Debug, Serialize, JsonSchema)]
#[schemars(rename = "GrantDeleteSchema")]
pub struct GrantDeleteOutput {
pub output_kind: &'static str,
pub id: String,
pub principal: String,
pub spool: String,
pub server: String,
pub deleted: bool,
pub recommended_action: Option<String>,
}
#[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 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 redemption_secret: String,
pub allowance_remaining: Option<u32>,
}
#[derive(Serialize, JsonSchema)]
#[schemars(rename = "AuthSignupInviteSchema")]
pub struct SignupInviteOutput {
pub invite_id: String,
pub status: String,
pub bound_email: Option<String>,
pub expires_at: Option<String>,
}
#[derive(Serialize, JsonSchema)]
#[schemars(rename = "AuthSignupInviteListSchema")]
pub struct SignupInviteListOutput {
pub output_kind: &'static str,
pub invites: Vec<SignupInviteOutput>,
pub allowance_remaining: Option<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 spools: Vec<String>,
pub recommended_action: Option<String>,
}
#[derive(Debug, Serialize, JsonSchema)]
#[schemars(rename = "WhoamiIdentitySchema")]
pub struct WhoamiIdentity {
pub principal_id: String,
pub account_id: String,
pub handle: Option<String>,
pub acting_agent_id: Option<String>,
pub rooting_tier: String,
pub credential_id: Option<String>,
pub credential_subject: String,
pub credential_kind: String,
pub session_id: Option<String>,
pub authentication_methods: Vec<String>,
pub agent_provider: Option<String>,
pub agent_model: Option<String>,
pub available_actions: Vec<String>,
}