//! Arguments for `mcptest policy`.
use std::path::PathBuf;

use clap::{Args, Subcommand, ValueEnum};

/// Arguments for `mcptest policy`.
#[derive(Debug, Args)]
pub struct PolicyArgs {
    /// The `policy` subcommand to run.
    #[command(subcommand)]
    pub command: PolicyCommand,
}

/// Subcommands for `mcptest policy`.
#[derive(Debug, Subcommand)]
pub enum PolicyCommand {
    /// Evaluate a policy against saved mcptest artifacts.
    Simulate(PolicySimulateArgs),
}

/// Arguments for `mcptest policy simulate`.
#[derive(Debug, Args)]
pub struct PolicySimulateArgs {
    /// Policy file (declarative YAML rules + waivers).
    #[arg(long, value_name = "FILE")]
    pub policy: PathBuf,
    /// Run report JSON from `mcptest run --reporter json`.
    #[arg(long = "run-report", value_name = "FILE")]
    pub run_report: Option<PathBuf>,
    /// Judge certification record from `mcptest judge certify`.
    #[arg(long = "judge-cert", value_name = "FILE")]
    pub judge_cert: Option<PathBuf>,
    /// Conformance report JSON from `mcptest conformance run`.
    #[arg(long = "conformance-report", value_name = "FILE")]
    pub conformance_report: Option<PathBuf>,
    /// Security report JSON from `mcptest security`.
    #[arg(long, value_name = "FILE")]
    pub security: Option<PathBuf>,
    /// Model-compat diff JSON from `mcptest model-compat diff`.
    #[arg(long = "model-compat", value_name = "FILE")]
    pub model_compat: Option<PathBuf>,
    /// Evidence artifact JSON from `mcptest evidence`.
    #[arg(long, value_name = "FILE")]
    pub evidence: Option<PathBuf>,
    /// Exit non-zero when the policy fails (CI gate). Off by default (dry-run
    /// always exits 0 and just prints the verdict).
    #[arg(long)]
    pub gate: bool,
    /// Output format.
    #[arg(long, value_name = "FORMAT", default_value = "pretty")]
    pub format: PolicyFormat,
}

/// Output format for `policy simulate`.
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
#[value(rename_all = "lowercase")]
pub enum PolicyFormat {
    /// Human-readable verdict and per-rule lines.
    Pretty,
    /// The full [`mcptest_core::policy::PolicyOutcome`] as pretty JSON.
    Json,
}
