//! Red Team subcommand - adversarial review notification commands.

use crate::daemon::api::{ApiClient, RedTeamNotifyRequest};
use super::RedTeamNotifyArgs;

/// Handle the red-team notify command.
pub async fn handle_notify(args: RedTeamNotifyArgs) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
    let client = ApiClient::new(args.api_url, args.api_key)?;

    // Use --task if provided, otherwise fall back to MAKIMA_TASK_ID
    let related_task_id = args.task;

    let req = RedTeamNotifyRequest {
        message: args.message,
        severity: args.severity,
        related_task_id,
        file_path: args.file,
        context: args.context,
    };

    eprintln!("Sending red team notification...");
    let result = client.red_team_notify(req).await?;
    println!("{}", serde_json::to_string(&result.0)?);

    Ok(())
}
