//! Arguments for `mcptest web-bot-auth directory`.

use std::path::PathBuf;

use clap::{Args, Subcommand};

/// `mcptest web-bot-auth <subcommand>`: Web Bot Auth helper commands.
///
/// mcptest is a client, so these helpers support an operator who runs a bot:
/// the only subcommand today prints the public-key directory document a
/// server publishes so verifiers can find the bot's public key.
#[derive(Debug, Args)]
pub struct WebBotAuthArgs {
    /// Which Web Bot Auth helper to run.
    #[command(subcommand)]
    pub command: WebBotAuthCommand,
}

/// Web Bot Auth helper subcommands.
#[derive(Debug, Subcommand)]
pub enum WebBotAuthCommand {
    /// Print the `.well-known/http-message-signatures-directory` JWK Set for
    /// a signing key. Emits the PUBLIC key only; the private key is never
    /// printed.
    Directory(DirectoryArgs),
}

/// Arguments for `mcptest web-bot-auth directory`.
///
/// The key source mirrors the YAML config: a PKCS#8 PEM file path or an env
/// var holding the PEM. Exactly one must be set. The algorithm selects how
/// the public key is shaped in the JWK.
#[derive(Debug, Args)]
pub struct DirectoryArgs {
    /// PKCS#8 PEM file holding the private signing key. Mutually exclusive
    /// with `--key-env`. Only the derived public key is emitted.
    #[arg(long = "key", value_name = "PATH")]
    pub key: Option<PathBuf>,

    /// Env var holding the PKCS#8 PEM private key. Mutually exclusive with
    /// `--key`. Names the var; the key is never passed on the command line.
    #[arg(long = "key-env", value_name = "VAR")]
    pub key_env: Option<String>,

    /// Signature algorithm: `ed25519` (default) or `rsa-pss`. Must match the
    /// key type.
    #[arg(long = "algorithm", value_name = "ALG", default_value = "ed25519")]
    pub algorithm: String,

    /// `Signature-Agent` URL identifying the bot. Recorded in the config the
    /// builder validates; it does not appear in the JWK Set itself.
    #[arg(
        long = "agent",
        value_name = "URL",
        default_value = "https://mcptest.sh"
    )]
    pub agent: String,
}
