#
#   Imandra Inc.
#
#   speclogician/presentation/preview/fixtures/state_instance_summary.py
#

from __future__ import annotations

from speclogician.presentation.ctx import RenderCtx
from speclogician.presentation.models.state_instance_summary import StateInstanceSummaryPM
from speclogician.presentation.renderers.state_instance_summary import render_state_instance_summary


def make_state_instance_summary_pm(ctx: RenderCtx, variant: str) -> StateInstanceSummaryPM:
    if variant == "minimal":
        return StateInstanceSummaryPM(
            created_at="1970-01-01T00:00:00Z",
            num_changes=0,
            base_status="UNKNOWN",
            base_has_state=False,
            base_has_action=False,
            num_preds_total=0,
            num_preds_matched=0,
            num_trans_total=0,
            num_trans_valid_logic=0,
            num_sc_total=0,
            num_sc_missing=0,
            num_sc_inconsistent=0,
            num_sc_conflicted=0,
            num_test_traces_total=0,
            num_test_traces_logic_good=0,
            num_log_traces_total=0,
            num_log_traces_logic_good=0,
        )

    if variant == "edge":
        return StateInstanceSummaryPM(
            created_at="2026-01-09T10:12:00Z",
            num_changes=1234,
            base_status="VALID",
            base_has_state=True,
            base_has_action=True,
            num_preds_total=999,
            num_preds_matched=888,
            num_trans_total=77,
            num_trans_valid_logic=66,
            num_sc_total=55,
            num_sc_missing=44,
            num_sc_inconsistent=33,
            num_sc_conflicted=22,
            num_test_traces_total=111,
            num_test_traces_logic_good=100,
            num_log_traces_total=200,
            num_log_traces_logic_good=199,
        )

    # typical
    return StateInstanceSummaryPM(
        created_at="2026-01-09T10:12:00Z",
        num_changes=2,
        base_status="VALID",
        base_has_state=True,
        base_has_action=True,
        num_preds_total=12,
        num_preds_matched=7,
        num_trans_total=4,
        num_trans_valid_logic=3,
        num_sc_total=9,
        num_sc_missing=1,
        num_sc_inconsistent=0,
        num_sc_conflicted=0,
        num_test_traces_total=8,
        num_test_traces_logic_good=6,
        num_log_traces_total=4,
        num_log_traces_logic_good=4,
    )


def render(pm: StateInstanceSummaryPM, ctx: RenderCtx):
    return render_state_instance_summary(pm, ctx=ctx)
