from typing import Set, List
from dataclasses import dataclass

@dataclass
class OrphanReport:
    orphans: List[str]
    authorized_missing: List[str]
    total_scanned: int

class OrphanDetector:
    """Compares manifest assets with detected assets to flag orphans."""
    
    def __init__(self, authorized_paths: Set[str], detected_paths: Set[str]):
        self.authorized = authorized_paths
        self.detected = detected_paths

    def detect(self) -> OrphanReport:
        # Orphans: Detected but not in manifest
        orphans = sorted(list(self.detected - self.authorized))
        
        # Missing: In manifest but not found on disk
        missing = sorted(list(self.authorized - self.detected))
        
        return OrphanReport(
            orphans=orphans,
            authorized_missing=missing,
            total_scanned=len(self.detected)
        )
