from __future__ import annotations

from checkin_cli.weekly_operations_wizard_host_events_r4 import (
    project_customer_event_state,
)


def test_event_projection_ignores_superseded_weekly_evidence() -> None:
    # Given: prior-week evidence superseded by a correction.
    state = {
        "kst_day": "2026-08-24",
        "events": (
            {
                "event_id": "old",
                "event_type": "morning_checkin",
                "occurred_at_kst": "2026-08-17T08:00:00+09:00",
                "status": "accepted",
                "check_in": {"body_weight_kg": 70.0},
            },
            {
                "event_id": "new",
                "event_type": "correction",
                "occurred_at_kst": "2026-08-17T08:01:00+09:00",
                "status": "accepted",
                "supersedes": "old",
                "check_in": {"body_weight_kg": 71.0},
            },
        ),
    }

    # When: canonical weekly state is projected.
    projected = project_customer_event_state(state)

    # Then: only the active correction contributes weight evidence.
    assert projected["prior_week_same_weekday_weight"] == 71.0
