from pydantic import BaseModel
from typing import Any
from enum import Enum


class ConflictType(str, Enum):
    CONTRADICTION = "contradiction"
    TENSION = "tension"
    TEMPORAL_SEQUENCE = "temporal_sequence"


class Conflict(BaseModel):
    conflict_type: ConflictType
    description: str
    tiers_involved: list[str]  # ["working", "episodic", "semantic"]
    memory_a_id: str
    memory_a_tier: str
    memory_a_content: str
    memory_b_id: str
    memory_b_tier: str
    memory_b_content: str
    similarity_score: float = 0.0


class ArbitrationResult(BaseModel):
    conflicts_detected: int = 0
    conflicts: list[Conflict] = []
    resolution_strategy: str = "none"
    winner_tier: str | None = None
    unified_context: str = ""
    explanation: str = ""
    tier_weights: dict[str, float] = {}
    metadata: dict[str, Any] = {}
