//! Arguments for `mcptest fault-coverage`.

use std::path::PathBuf;

use clap::{Args, ValueEnum};

/// Arguments for `mcptest fault-coverage`.
///
/// The command answers "which runtime fault families did this suite exercise?"
/// It loads the runtime fault taxonomy (embedded, or `--registry`), detects the
/// probes a suite uses, folds in any `--probe` tokens for probes run
/// out-of-band (a separate `mcptest fuzz` pass, say), and marks each fault
/// family covered, partial, uncovered, or not applicable.
#[derive(Debug, Args, Default)]
pub struct FaultCoverageArgs {
    /// Suite YAML to analyze for the probes it exercises. Defaults to
    /// `./mcptest.yaml`. Pass `--no-suite` to report the bare taxonomy.
    #[arg(value_name = "SUITE")]
    pub suite: Option<PathBuf>,

    /// Report the taxonomy without analyzing any suite (combine with
    /// `--probe` to score an out-of-band pipeline).
    #[arg(long)]
    pub no_suite: bool,

    /// Path to a taxonomy registry to use instead of the embedded one.
    #[arg(long, value_name = "PATH")]
    pub registry: Option<PathBuf>,

    /// Additional probe token to count as exercised, for probes run outside
    /// this suite (for example `--probe fuzz --probe negative-path`).
    /// Repeatable. Must be a known probe token.
    #[arg(long = "probe", value_name = "TOKEN")]
    pub probes: Vec<String>,

    /// Quality gate as a percentage (0 to 100), applied to applicable-fault
    /// coverage. When the computed coverage is below it, the command exits 6.
    #[arg(long, value_name = "PERCENT")]
    pub threshold: Option<f64>,

    /// Output format for the report.
    #[arg(
        long,
        value_enum,
        value_name = "FORMAT",
        default_value_t = FaultCoverageFormat::Pretty
    )]
    pub format: FaultCoverageFormat,
}

/// Output formats accepted by `mcptest fault-coverage --format`.
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, ValueEnum)]
#[value(rename_all = "kebab-case")]
pub enum FaultCoverageFormat {
    /// Human-friendly table (default).
    #[default]
    Pretty,
    /// One JSON object: the taxonomy coverage report.
    Json,
}
