# Copy the content from the artifact above
# src/models/data_models.py
"""
Core data models and enums for the self-improving code generator
"""

from typing import Dict, List, Any, Optional
from dataclasses import dataclass
from enum import Enum
from datetime import datetime

class TechnologyStack(Enum):
    """Supported technology stacks"""
    NODEJS_REACT = "nodejs_react"
    NODEJS_VUE = "nodejs_vue" 
    NODEJS_ANGULAR = "nodejs_angular"
    PYTHON_DJANGO = "python_django"
    PYTHON_FASTAPI = "python_fastapi"
    PYTHON_FLASK = "python_flask"
    JAVA_SPRING = "java_spring"
    DOTNET_CORE = "dotnet_core"
    PHP_LARAVEL = "php_laravel"
    RUBY_RAILS = "ruby_rails"
    FLUTTER_DART = "flutter_dart"
    REACT_NATIVE = "react_native"
    SWIFT_IOS = "swift_ios"
    KOTLIN_ANDROID = "kotlin_android"

class ImprovementLevel(Enum):
    """Progressive enhancement levels"""
    CRITICAL = 1      # Auto-apply (entry points, configs)
    CORE = 2          # Auto-suggest with preview
    ADVANCED = 3      # On-demand optimizations

class QualityCategory(Enum):
    """Quality assessment categories"""
    ARCHITECTURE = "architecture"
    SECURITY = "security"
    TESTING = "testing"
    PERFORMANCE = "performance"
    DOCUMENTATION = "documentation"
    ERROR_HANDLING = "error_handling"
    API_DESIGN = "api_design"
    DATABASE_DESIGN = "database_design"

@dataclass
class TechnologyProfile:
    """Technology stack detection profile"""
    name: str
    stack: TechnologyStack
    detection_patterns: Dict[str, List[str]]
    package_files: List[str]
    file_extensions: List[str]
    folder_patterns: List[str]
    confidence_score: float = 0.0

@dataclass
class QualityMetric:
    """Individual quality metric assessment"""
    category: QualityCategory
    score: float  # 0-100
    issues: List[str]
    suggestions: List[str]
    missing_components: List[str]

@dataclass
class ImprovementSuggestion:
    """Individual improvement suggestion"""
    id: str
    level: ImprovementLevel
    category: QualityCategory
    title: str
    description: str
    impact: str  # "High", "Medium", "Low"
    effort: str  # "High", "Medium", "Low"
    files_affected: List[str]
    code_changes: Dict[str, str]  # file_path -> new_content
    dependencies: List[str]  # Other improvements this depends on

@dataclass
class ProjectAnalysis:
    """Complete project analysis results"""
    project_id: str
    detected_stack: TechnologyStack
    confidence: float
    quality_metrics: List[QualityMetric]
    overall_score: float
    improvements: List[ImprovementSuggestion]
    missing_critical_components: List[str]
    analysis_timestamp: datetime

@dataclass
class UserPreferences:
    """User learning and preferences"""
    user_id: str
    commonly_accepted_patterns: List[str]
    commonly_rejected_patterns: List[str]
    preferred_tech_stacks: List[TechnologyStack]
    quality_priorities: List[QualityCategory]
    auto_apply_level: ImprovementLevel