//! Arguments for `mcptest import`.

use std::path::PathBuf;

use clap::{Args, ValueEnum};

/// Normalize an external benchmark or eval task corpus into a mcptest agent
/// suite.
///
/// The input is a third-party task list (mcptest's generic shape, or a
/// promptfoo config); the output is an agent suite YAML with a provenance
/// header that runs through the normal pipeline. Point `--server` at the
/// server under test and edit the generated placeholders before running. The
/// security-scanner importer lives separately under `mcptest security import`.
#[derive(Debug, Args)]
pub struct ImportArgs {
    /// Path to the external task corpus (JSON).
    pub file: PathBuf,

    /// Input shape to parse.
    #[arg(long, value_enum, value_name = "KIND", default_value_t = ImportKind::Generic)]
    pub kind: ImportKind,

    /// Server the imported agents target. Repeatable; declared in the output
    /// with a placeholder command to edit. Defaults to a single `server`.
    #[arg(long = "server", value_name = "NAME")]
    pub servers: Vec<String>,

    /// Model the imported agents run.
    #[arg(long, value_name = "MODEL", default_value = "claude-sonnet-4-5")]
    pub model: String,

    /// Source corpus name recorded in the provenance header. Defaults to the
    /// input kind.
    #[arg(long, value_name = "NAME")]
    pub source: Option<String>,

    /// Source URL recorded in the provenance header.
    #[arg(long, value_name = "URL")]
    pub source_url: Option<String>,

    /// License of the source corpus recorded in the provenance header.
    #[arg(long, value_name = "SPDX")]
    pub license: Option<String>,

    /// Write the generated suite here instead of stdout.
    #[arg(long, value_name = "PATH")]
    pub output: Option<PathBuf>,

    /// Overwrite the output if it already exists (off by default so a re-run
    /// cannot silently clobber a tracked or hand-edited file).
    #[arg(long)]
    pub force: bool,
}

/// External shapes `mcptest import` understands.
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, ValueEnum)]
#[value(rename_all = "kebab-case")]
pub enum ImportKind {
    /// mcptest's documented generic task list (a top-level array or
    /// `{ "tasks": [...] }`).
    #[default]
    Generic,
    /// A promptfoo `tests:` / `redteam:` config.
    Promptfoo,
}
