from __future__ import annotations
from dataclasses import dataclass

from ..state import EngineStateError, SimulationResult
from ..v2.contracts import SportingResolutionV2
from ..reporting.v22 import MatchReportV22


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

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