//! Arguments for `mcptest drift`.
//!
//! The drift subcommand watches a remote MCP server for schema drift (a
//! renamed or removed parameter) and behavioral drift (a golden canary call
//! that used to return rows now returns nothing). `capture` records a baseline
//! state; `check` compares a current capture against it and fails the run with
//! a classified diff. The comparison is deterministic and offline; only
//! `capture` (and `check --spec`) touch the network.

use std::path::PathBuf;

use clap::{Args, Subcommand};

/// Arguments for `mcptest drift`.
#[derive(Debug, Args)]
pub struct DriftArgs {
    /// Which drift operation to run.
    #[command(subcommand)]
    pub command: DriftCommand,
}

/// Subcommands for `mcptest drift`.
#[derive(Debug, Subcommand)]
pub enum DriftCommand {
    /// Connect to the server in a spec, snapshot its tool catalog, run the
    /// golden canary calls, and write a drift-state file (the baseline, or a
    /// current capture).
    Capture(DriftCaptureArgs),
    /// Compare a current capture against a baseline and fail on a breaking
    /// schema change or any behavioral drift.
    Check(DriftCheckArgs),
}

/// Arguments for `mcptest drift capture`.
#[derive(Debug, Args)]
pub struct DriftCaptureArgs {
    /// Drift spec (YAML/JSON): the `server:` to connect to and the `canaries:`
    /// to run.
    #[arg(value_name = "SPEC")]
    pub spec: PathBuf,

    /// Write the captured drift state here.
    #[arg(short, long, value_name = "PATH")]
    pub output: PathBuf,

    /// Overwrite the baseline if it already exists (off by default so a re-run
    /// cannot silently clobber the baseline every later `drift check` reads).
    #[arg(long)]
    pub force: bool,
}

/// Arguments for `mcptest drift check`.
#[derive(Debug, Args)]
pub struct DriftCheckArgs {
    /// Baseline drift-state file to compare against.
    #[arg(long, value_name = "PATH")]
    pub baseline: PathBuf,

    /// A current drift-state file to compare (offline). Mutually exclusive
    /// with `--spec`.
    #[arg(long, value_name = "PATH")]
    pub current: Option<PathBuf>,

    /// A drift spec to capture the current state live before comparing.
    /// Mutually exclusive with `--current`.
    #[arg(long, value_name = "PATH")]
    pub spec: Option<PathBuf>,

    /// Emit the structured drift report as JSON instead of the human summary.
    #[arg(long)]
    pub json: bool,
}
