//! Data types for the TUI application

use serde::{Deserialize, Serialize};

/// Task priority levels
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
#[derive(Default)]
pub enum TaskPriority {
    /// Critical priority (🔴)
    Critical,
    /// High priority (🟠)
    High,
    /// Medium priority (🟡)
    #[default]
    Medium,
    /// Low priority (🟢)
    Low,
}

/// Task type classifications
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
#[derive(Default)]
pub enum TaskType {
    /// Feature implementation (⭐)
    #[default]
    Feature,
    /// Bug fix (🐛)
    BugFix,
    /// Documentation (📚)
    Documentation,
    /// Testing task (✔)
    Testing,
    /// Deployment task (🚀)
    Deployment,
    /// Maintenance task (🔧)
    Maintenance,
}

/// Project data transfer object
#[derive(Debug, Clone, Serialize, Deserialize)]
pub(crate) struct ProjectDto {
    /// Project ID
    pub id: String,
    /// Project name
    pub name: String,
    /// Project version
    pub version: String,
    /// Project description
    pub description: String,
    /// Project type
    pub project_type: String,
    /// Current phase
    pub current_phase: String,
    /// Creation timestamp
    pub created_at: String,
    /// Last update timestamp
    pub updated_at: String,
}

/// Create project request
#[derive(Debug, Clone, Serialize, Deserialize)]
pub(crate) struct CreateProjectRequest {
    /// Project name
    pub name: String,
    /// Project description
    pub description: Option<String>,
    /// Project type
    pub project_type: Option<String>,
}

/// Project status DTO
#[derive(Debug, Clone, Serialize, Deserialize)]
pub(crate) struct ProjectStatusDto {
    /// Project ID
    pub id: String,
    /// Current phase
    pub current_phase: String,
    /// Checklist completion percentage
    pub checklist_completion: f64,
    /// Active tools count
    pub active_tools: usize,
    /// Latest security assessment
    pub latest_assessment: Option<SecurityAssessmentDto>,
}

/// Security assessment DTO
#[derive(Debug, Clone, Serialize, Deserialize)]
pub(crate) struct SecurityAssessmentDto {
    /// Assessment ID
    pub id: String,
    /// Security profile
    pub profile: String,
    /// Risk level
    pub risk_level: String,
    /// Passed rules count
    pub passed_rules: i32,
    /// Failed rules count
    pub failed_rules: i32,
    /// Critical issues count
    pub critical_issues: i32,
    /// Assessment timestamp
    pub assessment_date: String,
}

/// Checklist item DTO
#[derive(Debug, Clone, Serialize, Deserialize)]
pub(crate) struct ChecklistItemDto {
    /// Item ID
    pub id: String,
    /// Task ID
    pub task_id: String,
    /// Description
    pub description: String,
    /// Completion status
    pub completed: bool,
    /// Completion timestamp
    pub completed_at: Option<String>,
    /// Creation timestamp
    pub created_at: String,
    /// Task priority level
    #[serde(default)]
    pub priority: TaskPriority,
    /// Task type classification
    #[serde(default, rename = "type")]
    pub task_type: TaskType,
}

/// Tool configuration DTO
#[derive(Debug, Clone, Serialize, Deserialize)]
pub(crate) struct ToolDto {
    /// Tool name
    pub name: String,
    /// Tool enabled status
    pub enabled: bool,
    /// Tool description
    pub description: String,
}
