use std::path::PathBuf;
#[derive(Debug, clap::Parser)]
pub struct Cli {
    #[clap(subcommand)]
    pub cmd: SubCommand,
}

#[derive(Debug, clap::Subcommand)]
pub enum SubCommand {
    #[clap(name = "detect")]
    Detect(Detect),
    #[clap(name = "list")]
    List(List),
    #[clap(name = "completions")]
    Completions { shell: clap_complete::Shell },
}

#[derive(Debug, clap::ValueEnum, Clone, Copy)]
pub enum Models {
    RetinaFace,
}

#[derive(Debug, clap::ValueEnum, Clone, Copy)]
pub enum Executor {
    Mnn,
    Onnx,
}

#[derive(Debug, clap::ValueEnum, Clone, Copy)]
pub enum OnnxEp {
    Cpu,
}

#[derive(Debug, clap::ValueEnum, Clone, Copy)]
pub enum MnnEp {
    Cpu,
    Metal,
    OpenCL,
    CoreML,
}

#[derive(Debug, clap::Args)]
pub struct Detect {
    #[clap(short, long)]
    pub model: Option<PathBuf>,
    #[clap(short = 'M', long, default_value = "retina-face")]
    pub model_type: Models,
    pub image: PathBuf,
}

#[derive(Debug, clap::Args)]
pub struct List {}

impl Cli {
    pub fn completions(shell: clap_complete::Shell) {
        let mut command = <Cli as clap::CommandFactory>::command();
        clap_complete::generate(
            shell,
            &mut command,
            env!("CARGO_BIN_NAME"),
            &mut std::io::stdout(),
        );
    }
}
