//! Diagnostics command arguments

use clap::{Args, Subcommand};

/// Real-time diagnostics monitoring for streaming, simulation, and system resources
#[derive(Subcommand, Debug)]
pub enum DiagnosticsCommand {
    /// Show live diagnostics dashboard (all metrics)
    Watch {
        /// Filter by category
        #[command(flatten)]
        filter: DiagnosticsFilter,

        /// Refresh interval in seconds
        #[arg(short, long, default_value = "1")]
        interval: u64,
    },

    /// Export diagnostics snapshot to file
    Export {
        /// Output file path (JSON format)
        #[arg(short, long)]
        output: String,

        /// Duration to collect metrics (seconds)
        #[arg(short, long, default_value = "10")]
        duration: u64,
    },
}

/// Filter options for diagnostics
#[derive(Args, Debug, Clone)]
pub struct DiagnosticsFilter {
    /// Show streaming pipeline metrics only
    #[arg(long)]
    pub streaming: bool,

    /// Show Godot simulation metrics only
    #[arg(long)]
    pub godot: bool,

    /// Show Docker container metrics only
    #[arg(long)]
    pub docker: bool,

    /// Show system resource metrics only
    #[arg(long)]
    pub system: bool,

    /// Show all metrics (default)
    #[arg(long)]
    pub all: bool,
}

impl DiagnosticsFilter {
    /// Returns true if no specific filter is set (show all)
    pub fn is_all(&self) -> bool {
        self.all || (!self.streaming && !self.godot && !self.docker && !self.system)
    }

    /// Returns true if streaming metrics should be shown
    pub fn show_streaming(&self) -> bool {
        self.is_all() || self.streaming
    }

    /// Returns true if godot metrics should be shown
    pub fn show_godot(&self) -> bool {
        self.is_all() || self.godot
    }

    /// Returns true if docker metrics should be shown
    pub fn show_docker(&self) -> bool {
        self.is_all() || self.docker
    }

    /// Returns true if system metrics should be shown
    pub fn show_system(&self) -> bool {
        self.is_all() || self.system
    }
}
