//! CLI enum definitions
//!
//! This module contains all the enum types used by the CLI for command-line parsing
//! and output formatting. Each enum implements Display for testability.

use clap::ValueEnum;
use serde::{Deserialize, Serialize};
use std::fmt;

/// Execution mode for the CLI
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum ExecutionMode {
    Cli,
    Mcp,
}

impl fmt::Display for ExecutionMode {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            ExecutionMode::Cli => write!(f, "cli"),
            ExecutionMode::Mcp => write!(f, "mcp"),
        }
    }
}

/// Output format for general commands
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum OutputFormat {
    Table,
    Json,
    Yaml,
}

impl fmt::Display for OutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            OutputFormat::Table => write!(f, "table"),
            OutputFormat::Json => write!(f, "json"),
            OutputFormat::Yaml => write!(f, "yaml"),
        }
    }
}

/// Explain level for code explanations
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum ExplainLevel {
    Brief,
    Detailed,
    Verbose,
}

impl fmt::Display for ExplainLevel {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            ExplainLevel::Brief => write!(f, "brief"),
            ExplainLevel::Detailed => write!(f, "detailed"),
            ExplainLevel::Verbose => write!(f, "verbose"),
        }
    }
}

/// Enforce output format  
#[derive(Clone, Copy, Debug, ValueEnum, PartialEq, Serialize, Deserialize)]
pub enum EnforceOutputFormat {
    /// Summary output
    Summary,
    /// JSON output
    Json,
    /// Progress output
    Progress,
    /// SARIF format
    Sarif,
}

impl fmt::Display for EnforceOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            EnforceOutputFormat::Summary => write!(f, "summary"),
            EnforceOutputFormat::Json => write!(f, "json"),
            EnforceOutputFormat::Progress => write!(f, "progress"),
            EnforceOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Refactor output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum RefactorOutputFormat {
    Json,
    Table,
    Summary,
}

impl fmt::Display for RefactorOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            RefactorOutputFormat::Json => write!(f, "json"),
            RefactorOutputFormat::Table => write!(f, "table"),
            RefactorOutputFormat::Summary => write!(f, "summary"),
        }
    }
}

/// Prompt output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum PromptOutputFormat {
    Yaml,
    Json,
    Text,
}

impl fmt::Display for PromptOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            PromptOutputFormat::Yaml => write!(f, "yaml"),
            PromptOutputFormat::Json => write!(f, "json"),
            PromptOutputFormat::Text => write!(f, "text"),
        }
    }
}

/// Refactor mode
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum RefactorMode {
    Batch,
    Interactive,
}

impl fmt::Display for RefactorMode {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            RefactorMode::Batch => write!(f, "batch"),
            RefactorMode::Interactive => write!(f, "interactive"),
        }
    }
}

/// Refactor auto output format
#[derive(Clone, Copy, Debug, ValueEnum, PartialEq, Eq)]
pub enum RefactorAutoOutputFormat {
    /// Concise summary of progress
    Summary,
    /// Detailed progress information
    Detailed,
    /// JSON format for automation
    Json,
}

impl fmt::Display for RefactorAutoOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            RefactorAutoOutputFormat::Summary => write!(f, "summary"),
            RefactorAutoOutputFormat::Detailed => write!(f, "detailed"),
            RefactorAutoOutputFormat::Json => write!(f, "json"),
        }
    }
}

/// Refactor docs output format
#[derive(Clone, Copy, Debug, ValueEnum, PartialEq, Eq)]
pub enum RefactorDocsOutputFormat {
    /// Summary of found issues
    Summary,
    /// Detailed list with explanations
    Detailed,
    /// JSON format for automation
    Json,
    /// Interactive mode for confirmation
    Interactive,
}

impl fmt::Display for RefactorDocsOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            RefactorDocsOutputFormat::Summary => write!(f, "summary"),
            RefactorDocsOutputFormat::Detailed => write!(f, "detailed"),
            RefactorDocsOutputFormat::Json => write!(f, "json"),
            RefactorDocsOutputFormat::Interactive => write!(f, "interactive"),
        }
    }
}

/// Quality profile for refactoring
#[derive(Clone, Copy, Debug, ValueEnum, PartialEq, Eq, Default)]
pub enum QualityProfile {
    /// Standard quality profile
    Standard,
    /// Strict quality profile
    Strict,
    /// Extreme quality profile - RIGID standards
    #[default]
    Extreme,
}

impl fmt::Display for QualityProfile {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            QualityProfile::Standard => write!(f, "standard"),
            QualityProfile::Strict => write!(f, "strict"),
            QualityProfile::Extreme => write!(f, "extreme"),
        }
    }
}

/// Context format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum ContextFormat {
    Markdown,
    Json,
    Sarif,
    #[value(name = "llm-optimized")]
    LlmOptimized,
}

impl fmt::Display for ContextFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            ContextFormat::Markdown => write!(f, "markdown"),
            ContextFormat::Json => write!(f, "json"),
            ContextFormat::Sarif => write!(f, "sarif"),
            ContextFormat::LlmOptimized => write!(f, "llm-optimized"),
        }
    }
}

/// TDG output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum TdgOutputFormat {
    Table,
    Json,
    Markdown,
    Sarif,
}

impl fmt::Display for TdgOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            TdgOutputFormat::Table => write!(f, "table"),
            TdgOutputFormat::Json => write!(f, "json"),
            TdgOutputFormat::Markdown => write!(f, "markdown"),
            TdgOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Makefile output format
#[derive(Clone, Debug, ValueEnum, PartialEq, Serialize, Deserialize)]
pub enum MakefileOutputFormat {
    /// Human-readable output
    Human,
    /// JSON output
    Json,
    /// GCC-style output for editor integration
    Gcc,
    /// SARIF format for CI/CD integration
    Sarif,
}

impl fmt::Display for MakefileOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            MakefileOutputFormat::Human => write!(f, "human"),
            MakefileOutputFormat::Json => write!(f, "json"),
            MakefileOutputFormat::Gcc => write!(f, "gcc"),
            MakefileOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Lint hotspot output format
#[derive(Clone, Debug, ValueEnum, PartialEq, Serialize, Deserialize)]
pub enum LintHotspotOutputFormat {
    /// Summary output
    Summary,
    /// Detailed output
    Detailed,
    /// JSON output
    Json,
    /// Enforcement JSON output
    #[value(name = "enforcement-json")]
    EnforcementJson,
    /// SARIF format for CI/CD integration
    Sarif,
}

impl fmt::Display for LintHotspotOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            LintHotspotOutputFormat::Summary => write!(f, "summary"),
            LintHotspotOutputFormat::Detailed => write!(f, "detailed"),
            LintHotspotOutputFormat::Json => write!(f, "json"),
            LintHotspotOutputFormat::EnforcementJson => write!(f, "enforcement-json"),
            LintHotspotOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Provability output format
#[derive(Clone, Debug, ValueEnum, PartialEq, Serialize, Deserialize)]
pub enum ProvabilityOutputFormat {
    /// Summary statistics only
    Summary,
    /// Full detailed report
    Full,
    /// JSON format for tools
    Json,
    /// SARIF format for CI/CD integration
    Sarif,
    /// Markdown report format
    Markdown,
}

impl fmt::Display for ProvabilityOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            ProvabilityOutputFormat::Summary => write!(f, "summary"),
            ProvabilityOutputFormat::Full => write!(f, "full"),
            ProvabilityOutputFormat::Json => write!(f, "json"),
            ProvabilityOutputFormat::Sarif => write!(f, "sarif"),
            ProvabilityOutputFormat::Markdown => write!(f, "markdown"),
        }
    }
}

/// Duplicate type
#[derive(Clone, Debug, ValueEnum, PartialEq, Serialize)]
pub enum DuplicateType {
    /// Exact duplicates (Type 1 clones)
    Exact,
    /// Renamed duplicates (Type 2 clones)
    Renamed,
    /// Gapped duplicates (Type 3 clones)
    Gapped,
    /// Semantic duplicates using AST similarity
    Semantic,
    /// Fuzzy matching (similar but not exact)
    Fuzzy,
    /// All types of duplicates
    All,
}

impl fmt::Display for DuplicateType {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DuplicateType::Exact => write!(f, "exact"),
            DuplicateType::Renamed => write!(f, "renamed"),
            DuplicateType::Gapped => write!(f, "gapped"),
            DuplicateType::Semantic => write!(f, "semantic"),
            DuplicateType::Fuzzy => write!(f, "fuzzy"),
            DuplicateType::All => write!(f, "all"),
        }
    }
}

/// Defect prediction output format
#[derive(Clone, Debug, ValueEnum, PartialEq, Serialize)]
pub enum DefectPredictionOutputFormat {
    /// Summary statistics only
    Summary,
    /// Detailed analysis with recommendations
    Detailed,
    /// JSON format for tooling
    Json,
    /// CSV format for spreadsheet import
    Csv,
    /// SARIF format for IDE integration
    Sarif,
}

impl fmt::Display for DefectPredictionOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DefectPredictionOutputFormat::Summary => write!(f, "summary"),
            DefectPredictionOutputFormat::Detailed => write!(f, "detailed"),
            DefectPredictionOutputFormat::Json => write!(f, "json"),
            DefectPredictionOutputFormat::Csv => write!(f, "csv"),
            DefectPredictionOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Comprehensive output format
#[derive(Clone, Debug, ValueEnum, PartialEq, Serialize)]
pub enum ComprehensiveOutputFormat {
    /// Executive summary report
    Summary,
    /// Detailed unified analysis report
    Detailed,
    /// JSON format for tooling integration
    Json,
    /// Markdown report format
    Markdown,
    /// SARIF format for IDE integration
    Sarif,
}

impl fmt::Display for ComprehensiveOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            ComprehensiveOutputFormat::Summary => write!(f, "summary"),
            ComprehensiveOutputFormat::Detailed => write!(f, "detailed"),
            ComprehensiveOutputFormat::Json => write!(f, "json"),
            ComprehensiveOutputFormat::Markdown => write!(f, "markdown"),
            ComprehensiveOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Graph metric type
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum GraphMetricType {
    /// Degree centrality
    Centrality,
    /// Betweenness centrality
    Betweenness,
    /// Closeness centrality
    Closeness,
    /// `PageRank` scores
    PageRank,
    /// Clustering coefficient
    Clustering,
    /// Connected components analysis
    Components,
    /// All available metrics
    All,
}

impl GraphMetricType {
    /// Get the string representation of the graph metric type
    fn as_str(&self) -> &'static str {
        match self {
            GraphMetricType::Centrality => "centrality",
            GraphMetricType::Betweenness => "betweenness",
            GraphMetricType::Closeness => "closeness",
            GraphMetricType::PageRank => "pagerank",
            GraphMetricType::Clustering => "clustering",
            GraphMetricType::Components => "components",
            GraphMetricType::All => "all",
        }
    }
}

impl fmt::Display for GraphMetricType {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

/// Graph metrics output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum GraphMetricsOutputFormat {
    /// Summary statistics only
    Summary,
    /// Detailed metrics with rankings
    Detailed,
    /// Human-readable format
    Human,
    /// JSON format for tooling integration
    Json,
    /// CSV format for spreadsheet import
    Csv,
    /// `GraphML` export format
    GraphML,
    /// Markdown report format
    Markdown,
}

impl GraphMetricsOutputFormat {
    /// Get the string representation of the output format
    fn as_str(&self) -> &'static str {
        match self {
            GraphMetricsOutputFormat::Summary => "summary",
            GraphMetricsOutputFormat::Detailed => "detailed",
            GraphMetricsOutputFormat::Human => "human",
            GraphMetricsOutputFormat::Json => "json",
            GraphMetricsOutputFormat::Csv => "csv",
            GraphMetricsOutputFormat::GraphML => "graphml",
            GraphMetricsOutputFormat::Markdown => "markdown",
        }
    }
}

impl fmt::Display for GraphMetricsOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

/// Search scope
#[derive(Clone, Copy, Debug, ValueEnum, PartialEq)]
pub enum SearchScope {
    /// Search function names
    Functions,
    /// Search type/class names
    Types,
    /// Search variable names
    Variables,
    /// Search all identifiers
    All,
}

impl fmt::Display for SearchScope {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            SearchScope::Functions => write!(f, "functions"),
            SearchScope::Types => write!(f, "types"),
            SearchScope::Variables => write!(f, "variables"),
            SearchScope::All => write!(f, "all"),
        }
    }
}

/// Name similarity output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum NameSimilarityOutputFormat {
    /// Summary of matches only
    Summary,
    /// Detailed match analysis
    Detailed,
    /// Human-readable format
    Human,
    /// JSON format for tooling integration
    Json,
    /// CSV format for spreadsheet import
    Csv,
    /// Markdown report format
    Markdown,
}

impl fmt::Display for NameSimilarityOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            NameSimilarityOutputFormat::Summary => write!(f, "summary"),
            NameSimilarityOutputFormat::Detailed => write!(f, "detailed"),
            NameSimilarityOutputFormat::Human => write!(f, "human"),
            NameSimilarityOutputFormat::Json => write!(f, "json"),
            NameSimilarityOutputFormat::Csv => write!(f, "csv"),
            NameSimilarityOutputFormat::Markdown => write!(f, "markdown"),
        }
    }
}

/// Duplicate output format
#[derive(Clone, Debug, ValueEnum, PartialEq, Serialize)]
pub enum DuplicateOutputFormat {
    /// Summary statistics only
    Summary,
    /// Detailed duplicate listing
    Detailed,
    /// Human-readable format
    Human,
    /// JSON format for tooling
    Json,
    /// CSV format for spreadsheet import
    Csv,
    /// SARIF format for IDE integration
    Sarif,
}

impl fmt::Display for DuplicateOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DuplicateOutputFormat::Summary => write!(f, "summary"),
            DuplicateOutputFormat::Detailed => write!(f, "detailed"),
            DuplicateOutputFormat::Human => write!(f, "human"),
            DuplicateOutputFormat::Json => write!(f, "json"),
            DuplicateOutputFormat::Csv => write!(f, "csv"),
            DuplicateOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Complexity output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum ComplexityOutputFormat {
    /// Summary statistics only
    Summary,
    /// Full report with violations
    Full,
    /// JSON format for tools
    Json,
    /// SARIF format for IDE integration
    Sarif,
}

impl fmt::Display for ComplexityOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            ComplexityOutputFormat::Summary => write!(f, "summary"),
            ComplexityOutputFormat::Full => write!(f, "full"),
            ComplexityOutputFormat::Json => write!(f, "json"),
            ComplexityOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Dead code output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum DeadCodeOutputFormat {
    Summary,
    Json,
    Sarif,
    Markdown,
}

impl fmt::Display for DeadCodeOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DeadCodeOutputFormat::Summary => write!(f, "summary"),
            DeadCodeOutputFormat::Json => write!(f, "json"),
            DeadCodeOutputFormat::Sarif => write!(f, "sarif"),
            DeadCodeOutputFormat::Markdown => write!(f, "markdown"),
        }
    }
}

/// Known Defects output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum DefectsOutputFormat {
    Text,
    Json,
    Junit,
}

impl fmt::Display for DefectsOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DefectsOutputFormat::Text => write!(f, "text"),
            DefectsOutputFormat::Json => write!(f, "json"),
            DefectsOutputFormat::Junit => write!(f, "junit"),
        }
    }
}

/// SATD output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum SatdOutputFormat {
    Summary,
    Json,
    Sarif,
    Markdown,
}

impl fmt::Display for SatdOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            SatdOutputFormat::Summary => write!(f, "summary"),
            SatdOutputFormat::Json => write!(f, "json"),
            SatdOutputFormat::Sarif => write!(f, "sarif"),
            SatdOutputFormat::Markdown => write!(f, "markdown"),
        }
    }
}

/// SATD severity levels
#[derive(Clone, Debug, ValueEnum, PartialEq, PartialOrd, Ord, Eq)]
pub enum SatdSeverity {
    Low,
    Medium,
    High,
    Critical,
}

impl fmt::Display for SatdSeverity {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            SatdSeverity::Low => write!(f, "low"),
            SatdSeverity::Medium => write!(f, "medium"),
            SatdSeverity::High => write!(f, "high"),
            SatdSeverity::Critical => write!(f, "critical"),
        }
    }
}

/// Symbol table output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum SymbolTableOutputFormat {
    /// Summary with statistics
    Summary,
    /// Detailed output with all symbols
    Detailed,
    /// Human-readable format
    Human,
    /// JSON format for tools
    Json,
    /// CSV format for spreadsheets
    Csv,
}

impl fmt::Display for SymbolTableOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            SymbolTableOutputFormat::Summary => write!(f, "summary"),
            SymbolTableOutputFormat::Detailed => write!(f, "detailed"),
            SymbolTableOutputFormat::Human => write!(f, "human"),
            SymbolTableOutputFormat::Json => write!(f, "json"),
            SymbolTableOutputFormat::Csv => write!(f, "csv"),
        }
    }
}

/// Big-O output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum BigOOutputFormat {
    /// Summary with complexity distribution
    Summary,
    /// JSON format for tools
    Json,
    /// Markdown report
    Markdown,
    /// Detailed analysis with all functions
    Detailed,
}

impl fmt::Display for BigOOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            BigOOutputFormat::Summary => write!(f, "summary"),
            BigOOutputFormat::Json => write!(f, "json"),
            BigOOutputFormat::Markdown => write!(f, "markdown"),
            BigOOutputFormat::Detailed => write!(f, "detailed"),
        }
    }
}

/// Symbol type filter
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum SymbolTypeFilter {
    /// Functions and methods
    Functions,
    /// Classes only
    Classes,
    /// Types, structs, and classes
    Types,
    /// Variables and constants
    Variables,
    /// Modules and namespaces
    Modules,
    /// All symbols
    All,
}

impl fmt::Display for SymbolTypeFilter {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            SymbolTypeFilter::Functions => write!(f, "functions"),
            SymbolTypeFilter::Classes => write!(f, "classes"),
            SymbolTypeFilter::Types => write!(f, "types"),
            SymbolTypeFilter::Variables => write!(f, "variables"),
            SymbolTypeFilter::Modules => write!(f, "modules"),
            SymbolTypeFilter::All => write!(f, "all"),
        }
    }
}

/// DAG generation type
#[derive(Clone, Debug, ValueEnum, PartialEq, Eq, Hash)]
pub enum DagType {
    /// Function call graph
    #[value(name = "call-graph")]
    CallGraph,

    /// Import/dependency graph
    #[value(name = "import-graph")]
    ImportGraph,

    /// Class inheritance hierarchy
    #[value(name = "inheritance")]
    Inheritance,

    /// Complete dependency graph
    #[value(name = "full-dependency")]
    FullDependency,
}

impl fmt::Display for DagType {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DagType::CallGraph => write!(f, "call-graph"),
            DagType::ImportGraph => write!(f, "import-graph"),
            DagType::Inheritance => write!(f, "inheritance"),
            DagType::FullDependency => write!(f, "full-dependency"),
        }
    }
}

/// Deep context output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum DeepContextOutputFormat {
    Markdown,
    Json,
    Sarif,
}

impl fmt::Display for DeepContextOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DeepContextOutputFormat::Markdown => write!(f, "markdown"),
            DeepContextOutputFormat::Json => write!(f, "json"),
            DeepContextOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Deep context DAG type
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum DeepContextDagType {
    #[value(name = "call-graph")]
    CallGraph,
    #[value(name = "import-graph")]
    ImportGraph,
    #[value(name = "inheritance")]
    Inheritance,
    #[value(name = "full-dependency")]
    FullDependency,
}

impl fmt::Display for DeepContextDagType {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DeepContextDagType::CallGraph => write!(f, "call-graph"),
            DeepContextDagType::ImportGraph => write!(f, "import-graph"),
            DeepContextDagType::Inheritance => write!(f, "inheritance"),
            DeepContextDagType::FullDependency => write!(f, "full-dependency"),
        }
    }
}

/// Deep context cache strategy
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum DeepContextCacheStrategy {
    Normal,
    #[value(name = "force-refresh")]
    ForceRefresh,
    Offline,
}

impl fmt::Display for DeepContextCacheStrategy {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DeepContextCacheStrategy::Normal => write!(f, "normal"),
            DeepContextCacheStrategy::ForceRefresh => write!(f, "force-refresh"),
            DeepContextCacheStrategy::Offline => write!(f, "offline"),
        }
    }
}

/// Demo protocol selection
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum DemoProtocol {
    Cli,
    Http,
    Mcp,
    #[cfg(feature = "tui")]
    Tui,
    All,
}

impl fmt::Display for DemoProtocol {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DemoProtocol::Cli => write!(f, "cli"),
            DemoProtocol::Http => write!(f, "http"),
            DemoProtocol::Mcp => write!(f, "mcp"),
            #[cfg(feature = "tui")]
            DemoProtocol::Tui => write!(f, "tui"),
            DemoProtocol::All => write!(f, "all"),
        }
    }
}

/// Proof annotation output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum ProofAnnotationOutputFormat {
    Summary,
    Full,
    Json,
    Markdown,
    Sarif,
}

impl fmt::Display for ProofAnnotationOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            ProofAnnotationOutputFormat::Summary => write!(f, "summary"),
            ProofAnnotationOutputFormat::Full => write!(f, "full"),
            ProofAnnotationOutputFormat::Json => write!(f, "json"),
            ProofAnnotationOutputFormat::Markdown => write!(f, "markdown"),
            ProofAnnotationOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Property type filter
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum PropertyTypeFilter {
    MemorySafety,
    ThreadSafety,
    DataRaceFreeze,
    Termination,
    FunctionalCorrectness,
    ResourceBounds,
    All,
}

impl PropertyTypeFilter {
    /// Get the string representation of the property type filter
    fn as_str(&self) -> &'static str {
        match self {
            PropertyTypeFilter::MemorySafety => "memory-safety",
            PropertyTypeFilter::ThreadSafety => "thread-safety",
            PropertyTypeFilter::DataRaceFreeze => "data-race-freeze",
            PropertyTypeFilter::Termination => "termination",
            PropertyTypeFilter::FunctionalCorrectness => "functional-correctness",
            PropertyTypeFilter::ResourceBounds => "resource-bounds",
            PropertyTypeFilter::All => "all",
        }
    }
}

impl fmt::Display for PropertyTypeFilter {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

/// Verification method filter
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum VerificationMethodFilter {
    FormalProof,
    ModelChecking,
    StaticAnalysis,
    AbstractInterpretation,
    BorrowChecker,
    All,
}

impl fmt::Display for VerificationMethodFilter {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            VerificationMethodFilter::FormalProof => write!(f, "formal-proof"),
            VerificationMethodFilter::ModelChecking => write!(f, "model-checking"),
            VerificationMethodFilter::StaticAnalysis => write!(f, "static-analysis"),
            VerificationMethodFilter::AbstractInterpretation => {
                write!(f, "abstract-interpretation")
            }
            VerificationMethodFilter::BorrowChecker => write!(f, "borrow-checker"),
            VerificationMethodFilter::All => write!(f, "all"),
        }
    }
}

/// Incremental coverage output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum IncrementalCoverageOutputFormat {
    Summary,
    Detailed,
    Json,
    Markdown,
    Lcov,
    Delta,
    Sarif,
}

impl IncrementalCoverageOutputFormat {
    /// Get the string representation of the output format
    fn as_str(&self) -> &'static str {
        match self {
            IncrementalCoverageOutputFormat::Summary => "summary",
            IncrementalCoverageOutputFormat::Detailed => "detailed",
            IncrementalCoverageOutputFormat::Json => "json",
            IncrementalCoverageOutputFormat::Markdown => "markdown",
            IncrementalCoverageOutputFormat::Lcov => "lcov",
            IncrementalCoverageOutputFormat::Delta => "delta",
            IncrementalCoverageOutputFormat::Sarif => "sarif",
        }
    }
}

impl fmt::Display for IncrementalCoverageOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

/// Quality gate output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum QualityGateOutputFormat {
    Summary,
    Detailed,
    Human,
    Json,
    Junit,
    Markdown,
}

impl fmt::Display for QualityGateOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            QualityGateOutputFormat::Summary => write!(f, "summary"),
            QualityGateOutputFormat::Detailed => write!(f, "detailed"),
            QualityGateOutputFormat::Human => write!(f, "human"),
            QualityGateOutputFormat::Json => write!(f, "json"),
            QualityGateOutputFormat::Junit => write!(f, "junit"),
            QualityGateOutputFormat::Markdown => write!(f, "markdown"),
        }
    }
}

/// Report output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum ReportOutputFormat {
    /// JSON format (default)
    Json,
    /// CSV format for spreadsheet analysis
    Csv,
    /// Markdown format with tables and visualizations
    Markdown,
    /// Plain text format
    Text,
    /// HTML format (legacy)
    Html,
    /// PDF format (legacy)
    Pdf,
    /// Dashboard format (legacy)
    Dashboard,
}

impl ReportOutputFormat {
    /// Get the string representation of the report output format
    fn as_str(&self) -> &'static str {
        match self {
            ReportOutputFormat::Json => "json",
            ReportOutputFormat::Csv => "csv",
            ReportOutputFormat::Markdown => "markdown",
            ReportOutputFormat::Text => "text",
            ReportOutputFormat::Html => "html",
            ReportOutputFormat::Pdf => "pdf",
            ReportOutputFormat::Dashboard => "dashboard",
        }
    }
}

impl fmt::Display for ReportOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

/// Output format for repository health score
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum RepoScoreOutputFormat {
    /// Text format with colored output (default)
    Text,
    /// JSON format for programmatic use
    Json,
    /// Markdown format with tables
    Markdown,
    /// YAML format
    Yaml,
}

impl RepoScoreOutputFormat {
    /// Get the string representation
    fn as_str(&self) -> &'static str {
        match self {
            RepoScoreOutputFormat::Text => "text",
            RepoScoreOutputFormat::Json => "json",
            RepoScoreOutputFormat::Markdown => "markdown",
            RepoScoreOutputFormat::Yaml => "yaml",
        }
    }
}

impl fmt::Display for RepoScoreOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

/// Analysis type
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum AnalysisType {
    Complexity,
    DeadCode,
    Duplication,
    TechnicalDebt,
    BigO,
    All,
}

impl fmt::Display for AnalysisType {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            AnalysisType::Complexity => write!(f, "complexity"),
            AnalysisType::DeadCode => write!(f, "dead-code"),
            AnalysisType::Duplication => write!(f, "duplication"),
            AnalysisType::TechnicalDebt => write!(f, "technical-debt"),
            AnalysisType::BigO => write!(f, "big-o"),
            AnalysisType::All => write!(f, "all"),
        }
    }
}

/// Quality check type
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum QualityCheckType {
    DeadCode,
    Complexity,
    Coverage,
    Sections,
    Provability,
    Satd,
    Entropy,
    Security,
    Duplicates,
    All,
}

impl QualityCheckType {
    /// Returns the default checks to run
    #[must_use]
    pub fn default_checks() -> Vec<Self> {
        vec![
            QualityCheckType::Complexity,
            QualityCheckType::DeadCode,
            QualityCheckType::Satd,
            QualityCheckType::Entropy,
            QualityCheckType::Security,
            QualityCheckType::Duplicates,
            QualityCheckType::Coverage,
            QualityCheckType::Sections,
            QualityCheckType::Provability,
        ]
    }
}

impl QualityCheckType {
    /// Get the string representation of the quality check type
    fn as_str(&self) -> &'static str {
        match self {
            QualityCheckType::DeadCode => "dead-code",
            QualityCheckType::Complexity => "complexity",
            QualityCheckType::Coverage => "coverage",
            QualityCheckType::Sections => "sections",
            QualityCheckType::Provability => "provability",
            QualityCheckType::Satd => "satd",
            QualityCheckType::Entropy => "entropy",
            QualityCheckType::Security => "security",
            QualityCheckType::Duplicates => "duplicates",
            QualityCheckType::All => "all",
        }
    }
}

impl fmt::Display for QualityCheckType {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_execution_mode_display() {
        assert_eq!(ExecutionMode::Cli.to_string(), "cli");
        assert_eq!(ExecutionMode::Mcp.to_string(), "mcp");
    }

    #[test]
    fn test_output_format_display() {
        assert_eq!(OutputFormat::Table.to_string(), "table");
        assert_eq!(OutputFormat::Json.to_string(), "json");
        assert_eq!(OutputFormat::Yaml.to_string(), "yaml");
    }

    #[test]
    fn test_satd_severity_ordering() {
        assert!(SatdSeverity::Low < SatdSeverity::Medium);
        assert!(SatdSeverity::Medium < SatdSeverity::High);
        assert!(SatdSeverity::High < SatdSeverity::Critical);
    }

    #[test]
    fn test_all_enum_displays() {
        // Test a sample from each enum to ensure Display is implemented
        assert_eq!(ExplainLevel::Brief.to_string(), "brief");
        assert_eq!(RefactorOutputFormat::Json.to_string(), "json");
        assert_eq!(RefactorMode::Batch.to_string(), "batch");
        assert_eq!(ContextFormat::Markdown.to_string(), "markdown");
        assert_eq!(TdgOutputFormat::Table.to_string(), "table");
        assert_eq!(MakefileOutputFormat::Human.to_string(), "human");
        assert_eq!(DuplicateType::Exact.to_string(), "exact");
        assert_eq!(GraphMetricType::PageRank.to_string(), "pagerank");
        assert_eq!(SearchScope::Functions.to_string(), "functions");
        assert_eq!(ComplexityOutputFormat::Summary.to_string(), "summary");
        assert_eq!(DeadCodeOutputFormat::Json.to_string(), "json");
        assert_eq!(SatdOutputFormat::Markdown.to_string(), "markdown");
        assert_eq!(SymbolTableOutputFormat::Csv.to_string(), "csv");
        assert_eq!(BigOOutputFormat::Detailed.to_string(), "detailed");
        assert_eq!(SymbolTypeFilter::All.to_string(), "all");
        assert_eq!(DagType::CallGraph.to_string(), "call-graph");
        assert_eq!(DeepContextOutputFormat::Sarif.to_string(), "sarif");
        assert_eq!(DemoProtocol::Http.to_string(), "http");
        assert_eq!(AnalysisType::BigO.to_string(), "big-o");
        assert_eq!(QualityCheckType::Coverage.to_string(), "coverage");
    }

    #[test]
    fn test_enum_equality() {
        assert_eq!(ExecutionMode::Cli, ExecutionMode::Cli);
        assert_ne!(ExecutionMode::Cli, ExecutionMode::Mcp);

        assert_eq!(OutputFormat::Json, OutputFormat::Json);
        assert_ne!(OutputFormat::Json, OutputFormat::Table);

        assert_eq!(SatdSeverity::Low, SatdSeverity::Low);
        assert_ne!(SatdSeverity::Low, SatdSeverity::High);

        assert_eq!(EntropyOutputFormat::Summary, EntropyOutputFormat::Summary);
        assert_ne!(EntropyOutputFormat::Summary, EntropyOutputFormat::Json);

        assert_eq!(EntropySeverity::Low, EntropySeverity::Low);
        assert_ne!(EntropySeverity::Low, EntropySeverity::High);
    }
}

/// Entropy analysis output format
#[derive(Clone, Debug, ValueEnum, PartialEq, Eq, Deserialize, Serialize)]
pub enum EntropyOutputFormat {
    /// Summary with top violations
    Summary,
    /// Detailed violation report
    Detailed,
    /// JSON format for tooling
    Json,
    /// Markdown report
    Markdown,
}

impl fmt::Display for EntropyOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            EntropyOutputFormat::Summary => write!(f, "summary"),
            EntropyOutputFormat::Detailed => write!(f, "detailed"),
            EntropyOutputFormat::Json => write!(f, "json"),
            EntropyOutputFormat::Markdown => write!(f, "markdown"),
        }
    }
}

/// Entropy violation severity levels
#[derive(Clone, Debug, ValueEnum, PartialEq, Eq, Deserialize, Serialize)]
pub enum EntropySeverity {
    /// Low severity violations
    Low,
    /// Medium severity violations
    Medium,
    /// High severity violations
    High,
}

impl fmt::Display for EntropySeverity {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            EntropySeverity::Low => write!(f, "low"),
            EntropySeverity::Medium => write!(f, "medium"),
            EntropySeverity::High => write!(f, "high"),
        }
    }
}

/// Output format for WASM analysis
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum WasmOutputFormat {
    /// Summary output with key metrics
    Summary,
    /// Detailed analysis with all components
    Detailed,
    /// JSON format for programmatic use
    Json,
    /// SARIF format for security results
    Sarif,
}

impl fmt::Display for WasmOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            WasmOutputFormat::Summary => write!(f, "summary"),
            WasmOutputFormat::Detailed => write!(f, "detailed"),
            WasmOutputFormat::Json => write!(f, "json"),
            WasmOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Deep WASM source language
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum DeepWasmLanguage {
    /// Rust language
    Rust,
    /// Ruchy language
    Ruchy,
}

impl fmt::Display for DeepWasmLanguage {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DeepWasmLanguage::Rust => write!(f, "rust"),
            DeepWasmLanguage::Ruchy => write!(f, "ruchy"),
        }
    }
}

/// Deep WASM analysis focus
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum DeepWasmFocus {
    /// Full pipeline analysis
    Full,
    /// Source code only
    Source,
    /// Compilation pipeline
    Compilation,
    /// Runtime behavior
    Runtime,
    /// JavaScript interop
    Interop,
}

impl fmt::Display for DeepWasmFocus {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DeepWasmFocus::Full => write!(f, "full"),
            DeepWasmFocus::Source => write!(f, "source"),
            DeepWasmFocus::Compilation => write!(f, "compilation"),
            DeepWasmFocus::Runtime => write!(f, "runtime"),
            DeepWasmFocus::Interop => write!(f, "interop"),
        }
    }
}

/// Deep WASM output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum DeepWasmOutputFormat {
    /// Markdown report
    Markdown,
    /// JSON data
    Json,
    /// HTML report
    Html,
}

impl fmt::Display for DeepWasmOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DeepWasmOutputFormat::Markdown => write!(f, "markdown"),
            DeepWasmOutputFormat::Json => write!(f, "json"),
            DeepWasmOutputFormat::Html => write!(f, "html"),
        }
    }
}

#[cfg(test)]
mod property_tests {
    use proptest::prelude::*;

    proptest! {
        #[test]
        fn basic_property_stability(_input in ".*") {
            // Basic property test for coverage
            prop_assert!(true);
        }

        #[test]
        fn module_consistency_check(_x in 0u32..1000) {
            // Module consistency verification
            prop_assert!(_x < 1001);
        }
    }
}

/// Output format for Five Whys debug analysis
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum DebugOutputFormat {
    Text,
    Json,
    Markdown,
}

impl fmt::Display for DebugOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DebugOutputFormat::Text => write!(f, "text"),
            DebugOutputFormat::Json => write!(f, "json"),
            DebugOutputFormat::Markdown => write!(f, "markdown"),
        }
    }
}
