#
#   Imandra Inc.
#
#   speclogician/presentation/models/state_diff.py
#

from __future__ import annotations

from typing import Any, Literal
from pydantic import BaseModel, Field

from speclogician.state.diff import ComparisonOutcome


class DiffRowPM(BaseModel):
    label: str
    before: Any
    after: Any
    outcome: ComparisonOutcome = ComparisonOutcome.UNKNOWN
    message: str = ""


class DiffSectionPM(BaseModel):
    title: str
    rows: list[DiffRowPM] = Field(default_factory=list)

    def empty(self) -> bool:
        return not self.rows


class StateDiffPM(BaseModel):
    kind: Literal["state_diff"] = "state_diff"
    has_changes: bool
    sections: list[DiffSectionPM] = Field(default_factory=list)