"""Domain enums and constants derived from requirements.

All enum values map directly to the requirements document. Values marked
with 'v1.1' are defined for forward compatibility but not used in MVP.
"""

from enum import StrEnum


class InvestigationCategory(StrEnum):
    """The seven categories of codebase investigation."""

    ARCHITECTURE = "architecture"
    DOMAIN_BUSINESS_LOGIC = "domain_business_logic"
    DATA_FLOW = "data_flow"
    DEPENDENCIES = "dependencies"
    CONVENTIONS = "conventions"
    TESTING = "testing"
    TECHNICAL_DEBT = "technical_debt"


class CampaignStatus(StrEnum):
    """Campaign lifecycle states. Progresses forward only."""

    INITIALIZING = "initializing"
    ACTIVE = "active"
    CLOSED = "closed"


class MissionStatus(StrEnum):
    """Mission availability and completion states."""

    LOCKED = "locked"
    AVAILABLE = "available"
    IN_PROGRESS = "in_progress"
    COMPLETED = "completed"


class MissionDifficulty(StrEnum):
    """Mission difficulty tiers with corresponding time estimates."""

    QUICK = "quick"
    MEDIUM = "medium"
    DEEP_DIVE = "deep_dive"

    @property
    def time_minutes(self) -> int:
        """Estimated time in minutes for this difficulty tier."""
        return _DIFFICULTY_TIME_MAP[self]


_DIFFICULTY_TIME_MAP: dict[MissionDifficulty, int] = {
    MissionDifficulty.QUICK: 15,
    MissionDifficulty.MEDIUM: 30,
    MissionDifficulty.DEEP_DIVE: 45,
}


class CompletionMethod(StrEnum):
    """How a mission was completed. v1.1 adds annotation and field_report."""

    SELF_REPORT = "self_report"
    ANNOTATION = "annotation"  # v1.1
    FIELD_REPORT = "field_report"  # v1.1


class CampaignMode(StrEnum):
    """Campaign modes. MVP defaults to onboarding; assessment is v1.1."""

    ONBOARDING = "onboarding"
    ASSESSMENT = "assessment"  # v1.1


class CharacterArchetype(StrEnum):
    """Character archetypes that affect mission ordering. Unused in MVP."""

    DETECTIVE = "detective"  # v1.1: architecture-focused
    FORENSIC_ANALYST = "forensic_analyst"  # v1.1: testing-focused
    FIXER = "fixer"  # v1.1: debt-focused


class Theme(StrEnum):
    """Available investigation themes. v1 ships with Film Noir only."""

    FILM_NOIR = "film_noir"


class EntryType(StrEnum):
    """Types of codebase entry points. Used during static analysis."""

    CLI = "cli"
    API_ROUTE = "api_route"
    EVENT_HANDLER = "event_handler"
    MAIN = "main"
    SCHEDULED_TASK = "scheduled_task"


class DependencyType(StrEnum):
    """Types of external dependencies."""

    LIBRARY = "library"
    SERVICE = "service"
    API = "api"
    DATABASE = "database"


# --- Defaults ---

DEFAULT_TOKEN_BUDGET = 50_000
DEFAULT_PROVIDER = "anthropic"
DEFAULT_THEME = Theme.FILM_NOIR

MAX_PREREQUISITE_DEPTH = 3
MIN_ROOT_MISSIONS_PER_CATEGORY = 1

# Priority scores for key file selection
FILE_PRIORITY_ENTRY_POINT = 100
FILE_PRIORITY_HIGH_CENTRALITY = 50
FILE_PRIORITY_HIGH_COMPLEXITY = 30
FILE_PRIORITY_TEST_FILE = 20
