"""
Replay Passport V2 - Stub Implementation

This module contains stub classes for ReplayPassportV2 and GuardianVerdictSummary.
These were references in old code but the full implementation was removed/deprecated.
This stub allows the system to run while the code is being refactored.

TODO: Remove these stubs once guardian code is fully refactored.
"""

from typing import Any, Dict, List, Optional
from pydantic import BaseModel, Field


class GuardianVerdictSummary(BaseModel):
    """Summary of a guardian verdict decision."""

    allowed: bool = Field(..., description="Whether the request was allowed")
    outcome: str = Field(..., description="Decision outcome (APPROVE, DEGRADE, etc.)")
    reason: Optional[str] = Field(None, description="Human-readable reason for decision")
    policy: Optional[str] = Field(None, description="Policy file that made the decision")
    metadata: Optional[Dict[str, Any]] = Field(None, description="Additional context/evidence")


class PassportLineage(BaseModel):
    """Lineage tracking for passport through system."""

    guardian_receipt_ids: List[str] = Field(default_factory=list, description="Guardian receipts")
    guardian_refusal_receipt_ids: List[str] = Field(
        default_factory=list, description="Guardian refusal receipts"
    )
    governor_receipt_ids: List[str] = Field(default_factory=list, description="Governor receipts")
    oracle_receipt_ids: List[str] = Field(default_factory=list, description="Oracle receipts")


class ReplayPassportV2(BaseModel):
    """
    Replay passport - tracks a request through the system.

    Stub implementation for backward compatibility.
    """

    request_id: str = Field(..., description="Unique request ID")
    passport_id: Optional[str] = Field(
        None, description="Alias for request_id used by guardian receipts"
    )
    vault_id: Optional[str] = Field(None, description="Vault this request belongs to")
    guardian_verdict: Optional[GuardianVerdictSummary] = Field(
        None, description="Guardian's verdict on this request"
    )
    lineage: PassportLineage = Field(
        default_factory=PassportLineage, description="Receipt lineage"
    )
    metadata: Dict[str, Any] = Field(default_factory=dict, description="Additional metadata")

    class Config:
        """Pydantic config."""

        arbitrary_types_allowed = True
