//! Lifecycle CLI command definitions.

use clap::Subcommand;

#[derive(Subcommand)]
pub enum LifecycleCommands {
    /// Deprecate a pattern
    ///
    /// Mark a pattern as deprecated with an optional replacement and sunset date.
    /// Deprecated patterns continue to match but FLAG with migration guidance.
    Deprecate {
        /// Pattern ID (UUID format)
        pattern_id: String,

        /// Reason for deprecation (required)
        #[arg(short, long)]
        reason: String,

        /// Pattern ID that supersedes this one
        #[arg(long)]
        superseded_by: Option<String>,

        /// Sunset date (ISO 8601 format: YYYY-MM-DD)
        #[arg(long)]
        sunset_date: Option<String>,

        /// URL or path to migration guide
        #[arg(long)]
        migration_guide: Option<String>,
    },

    /// Archive a pattern permanently
    ///
    /// Move a pattern to archived status. Archived patterns do not match
    /// during scans and are hidden from default listings.
    Archive {
        /// Pattern ID (UUID format)
        pattern_id: String,

        /// Reason for archival (required)
        #[arg(short, long)]
        reason: String,
    },

    /// Reactivate a deprecated pattern
    ///
    /// Remove deprecation and return pattern to active status.
    Reactivate {
        /// Pattern ID (UUID format)
        pattern_id: String,

        /// Reason for reactivation (required)
        #[arg(short, long)]
        reason: String,
    },

    /// Show lifecycle history for a pattern
    ///
    /// Display all status transitions for a pattern in chronological order.
    History {
        /// Pattern ID (UUID format)
        pattern_id: String,

        /// Output format: table or json
        #[arg(short, long, default_value = "table")]
        format: String,
    },

    /// List patterns by lifecycle status
    ///
    /// Filter patterns by their current lifecycle status.
    List {
        /// Filter by status: active, deprecated, superseded, archived
        #[arg(short, long)]
        status: Option<String>,

        /// Show only patterns past their sunset date
        #[arg(long)]
        overdue: bool,

        /// Output format: table or json
        #[arg(short, long, default_value = "table")]
        format: String,
    },
}

#[derive(Subcommand)]
pub enum MigrationCommands {
    /// Show migration status for deprecated patterns
    ///
    /// Display migration progress including usage counts, completion
    /// percentages, and blockers.
    Status {
        /// Filter by pattern ID
        #[arg(long)]
        pattern: Option<String>,

        /// Filter by scope
        #[arg(long)]
        scope: Option<String>,

        /// Output format: table or json
        #[arg(short, long, default_value = "table")]
        format: String,
    },

    /// Export migration data
    ///
    /// Export deprecated pattern usages to a file for reporting.
    Export {
        /// Output file path
        #[arg(short, long)]
        output: std::path::PathBuf,

        /// Output format: json or csv
        #[arg(short, long, default_value = "csv")]
        format: String,

        /// Include resolved usages
        #[arg(long)]
        include_resolved: bool,
    },

    /// Show migration blockers for a pattern
    ///
    /// List the specific usages preventing migration completion.
    Blockers {
        /// Pattern ID (UUID format)
        pattern_id: String,

        /// Filter by scope
        #[arg(long)]
        scope: Option<String>,
    },
}
