//! Arguments for `mcptest cache`.

use std::path::PathBuf;

use clap::{Args, Subcommand};

/// Args for `mcptest cache`.
///
/// Holds the subcommand selector plus the optional `--cache-dir`
/// override that points the store at a non-default root.
#[derive(Debug, Args)]
pub struct CacheArgs {
    /// Override the cache directory.
    #[arg(long = "cache-dir", value_name = "PATH", global = true)]
    pub cache_dir: Option<PathBuf>,

    /// Which cache subcommand the operator selected.
    #[command(subcommand)]
    pub command: CacheCommand,
}

/// Subcommands for `mcptest cache`.
#[derive(Debug, Subcommand)]
pub enum CacheCommand {
    /// List every cached entry with size and age.
    List,
    /// Print totals plus the placeholder hit-rate row.
    Stats,
    /// Remove entries. Without `--older-than`, removes every entry.
    Clear {
        /// Only remove entries older than this duration (e.g. 30m, 2h, 7d).
        #[arg(long = "older-than", value_name = "DURATION")]
        older_than: Option<String>,
    },
    /// Remove entries older than 30 days. CI-friendly alias for the
    /// common cleanup path so scripts do not have to pick a number.
    Prune,
}
