from dataclasses import dataclass, field
from enum import Enum
from typing import Dict, List, Optional


class Classification(str, Enum):
    CRITICAL = "critical"
    IMPORTANT = "important"
    OPTIONAL = "optional"
    EPHEMERAL = "ephemeral"
    UNKNOWN = "unknown"


@dataclass
class MountCandidate:
    service_name: str
    image: str
    source: str
    target: str
    mount_type: str
    read_only: bool = False
    env: Dict[str, str] = field(default_factory=dict)
    compose_project: Optional[str] = None


@dataclass
class RuleEvidence:
    rule_name: str
    classification: Classification
    score: int
    reasons: List[str] = field(default_factory=list)
    tags: List[str] = field(default_factory=list)


@dataclass
class ClassificationResult:
    candidate: MountCandidate
    classification: Classification
    confidence: float
    score: int
    reasons: List[str]
    tags: List[str]
    matched_rules: List[str]
    score_breakdown: Dict[str, int] = field(default_factory=dict)
