"""
Decision-making data models
"""

from dataclasses import dataclass, field
from typing import Dict, List, Any, Optional


@dataclass
class PerformanceAnalysis:
    """
    Strategy performance analysis result

    Attributes:
        overall_rating: Overall performance rating ('excellent' | 'good' | 'poor' | 'critical')
        strengths: List of strategy strengths
        weaknesses: List of strategy weaknesses
        key_metrics: Dictionary of key performance metrics
        trend_analysis: Trend analysis description
        confidence: Analysis confidence score (0-1)
        timestamp: Analysis timestamp
    """

    overall_rating: str  # 'excellent' | 'good' | 'poor' | 'critical'
    strengths: List[str]
    weaknesses: List[str]
    key_metrics: Dict[str, float]
    trend_analysis: str
    confidence: float
    timestamp: int


@dataclass
class Issue:
    """
    Identified strategy issue

    Attributes:
        issue_id: Unique issue identifier
        severity: Issue severity ('critical' | 'high' | 'medium' | 'low')
        category: Issue category ('risk' | 'performance' | 'logic' | 'parameter')
        description: Issue description
        affected_components: List of affected code components
        suggested_fix: Suggested fix description
        priority: Priority score (1-10)
    """

    issue_id: str
    severity: str  # 'critical' | 'high' | 'medium' | 'low'
    category: str  # 'risk' | 'performance' | 'logic' | 'parameter'
    description: str
    affected_components: List[str]
    suggested_fix: str
    priority: int


@dataclass
class CodeModification:
    """
    Code modification specification

    Attributes:
        file_path: Path to file to be modified
        modification_type: Type of modification ('parameter' | 'logic' | 'structure')
        target_component: Target component name
        current_value: Current value
        new_value: New value
        description: Modification description
    """

    file_path: str
    modification_type: str  # 'parameter' | 'logic' | 'structure'
    target_component: str
    current_value: Any
    new_value: Any
    description: str


@dataclass
class ImprovementPlan:
    """
    Strategy improvement plan

    Attributes:
        plan_id: Unique plan identifier
        issues_addressed: List of issue IDs being addressed
        modifications: List of code modifications
        expected_impact: Expected impact on metrics
        risk_level: Risk level ('low' | 'medium' | 'high')
        requires_review: Whether human review is required
        rationale: Plan rationale
        timestamp: Plan creation timestamp
    """

    plan_id: str
    issues_addressed: List[str]
    modifications: List[CodeModification]
    expected_impact: Dict[str, float]
    risk_level: str  # 'low' | 'medium' | 'high'
    requires_review: bool
    rationale: str
    timestamp: int


@dataclass
class ReviewRequest:
    """
    Human review request

    Attributes:
        request_id: Unique request identifier
        plan: Improvement plan to be reviewed
        reason: Reason for review request
        urgency: Request urgency ('low' | 'medium' | 'high')
        status: Review status ('pending' | 'approved' | 'rejected')
        reviewer_notes: Notes from reviewer
        timestamp: Request timestamp
    """

    request_id: str
    plan: ImprovementPlan
    reason: str
    urgency: str  # 'low' | 'medium' | 'high'
    status: str = "pending"  # 'pending' | 'approved' | 'rejected'
    reviewer_notes: Optional[str] = None
    timestamp: int = 0
