from __future__ import annotations
from dataclasses import dataclass

from ..state import EngineStateError, SimulationResult
from ..v2.contracts import SportingResolutionV2
from ..reporting.v21 import MatchReportV21


@dataclass(frozen=True, slots=True)
class MatchV21Outcome:
    result: SimulationResult
    resolution: SportingResolutionV2
    report: MatchReportV21

    def __post_init__(self):
        if self.result.home_score != self.resolution.final_home_score:
            raise EngineStateError("Outcome home score does not match sporting resolution.")
        if self.result.away_score != self.resolution.final_away_score:
            raise EngineStateError("Outcome away score does not match sporting resolution.")
