"""Closed vocabularies for source state, eligibility, adoption, and planning."""

from enum import Enum
from typing import TypeAlias


class OsmObjectType(str, Enum):
    """The only OSM primitive types supported by the service."""

    NODE = "node"
    WAY = "way"
    RELATION = "relation"


class SourcePresenceState(str, Enum):
    """Presence of an OSM identity in a source snapshot."""

    PRESENT = "present"
    MISSING = "missing"
    STALE_CONFIRMED = "stale_confirmed"
    REMAP_CANDIDATE = "remap_candidate"
    DELETED_IN_OSM = "deleted_in_osm"


class ProfileEligibilityState(str, Enum):
    """Eligibility of a present source object for one profile version."""

    ACTIVE = "active"
    OUT_OF_SCOPE = "out_of_scope"
    EXCLUDED = "excluded"
    PENDING_REVIEW = "pending_review"


class AcceptedMappingOutcome(str, Enum):
    """Outcomes that represent an accepted mapping."""

    EXACT = "exact"
    HIGH_CONFIDENCE = "high_confidence"
    REMAPPED = "remapped"


class CandidateReviewOutcome(str, Enum):
    """Candidate or review outcomes that are not accepted mappings."""

    AMBIGUOUS = "ambiguous"
    UNMATCHED = "unmatched"
    REJECTED = "rejected"
    COLLISION = "collision"
    NEEDS_REVIEW = "needs_review"
    ACCEPTED = "accepted"


AdoptionOutcome: TypeAlias = AcceptedMappingOutcome | CandidateReviewOutcome


class PlannedActionType(str, Enum):
    """Report-only reconciliation actions planned by Phase 2A."""

    INSERT = "INSERT"
    UPDATE = "UPDATE"
    NO_CHANGE = "NO_CHANGE"
    SOURCE_REMAP = "SOURCE_REMAP"
    MARK_STALE_EXTERNALLY = "MARK_STALE_EXTERNALLY"
    DELETE_SAFE_STALE = "DELETE_SAFE_STALE"
    SKIP_PROTECTED = "SKIP_PROTECTED"
    SKIP_AMBIGUOUS = "SKIP_AMBIGUOUS"


# Compatibility aliases make the state vocabulary discoverable without creating
# a second enum with a subtly different set of values.
SourcePresence = SourcePresenceState
ProfileEligibility = ProfileEligibilityState
ReconciliationAction = PlannedActionType
