//! Handler for `mcptest schema-lint`.

use anyhow::Result;

use crate::cli::args::schema_lint::{
    SchemaLintArgs as CliSchemaLintArgs, SchemaLintFormat as CliSchemaLintFormat,
};
use crate::commands;

/// Map the CLI args struct to [`commands::SchemaLintArgs`] and run the lint.
pub(crate) fn schema_lint_command(args: CliSchemaLintArgs) -> Result<i32> {
    let format = match args.format {
        CliSchemaLintFormat::Pretty => commands::SchemaLintFormat::Pretty,
        CliSchemaLintFormat::Json => commands::SchemaLintFormat::Json,
    };
    commands::run_schema_lint(commands::SchemaLintArgs {
        snapshot: args.snapshot,
        format,
        fix: args.fix,
        write: args.write,
        no_fail: args.no_fail,
    })
}
