#!/usr/bin/env python3
"""Poll predecessor left-overrun activation with branch-state watch values."""
from __future__ import annotations

from argparse import Namespace

import probe_runtime_input_path as runtime_input
from probe_runtime_input_path import DEFAULT_PREFIX, OUT
from probe_runtime_predecessor_direction_sweep_branch_state_poll import BRANCH_STATE_WATCH_VALUES
from probe_runtime_selected_pointer_multislot_savedata_poll import build_summary
from probe_runtime_selected_pointer_poll import write_outputs


OUTPUT_PREFIX = "runtime_selected_pointer_predecessor_left_overrun_activation_branch_state_poll"


def main() -> None:
    runtime_input.ROUTE_WATCH_VALUES = dict(runtime_input.ROUTE_WATCH_VALUES)
    runtime_input.ROUTE_WATCH_VALUES.update(BRANCH_STATE_WATCH_VALUES)
    args = Namespace(
        startup_wait=18.0,
        hold=0.7,
        gap=0.25,
        interval=0.02,
        prelude="input-path",
        sequence=[
            "left-overrun-five=Down,Return,Left,Left,Left,Left,Up,Left,Left,Left",
            "left-overrun-return=Down,Return,Left,Left,Left,Left,Up,Left,Left,Left,Return",
            "left-overrun-z=Down,Return,Left,Left,Left,Left,Up,Left,Left,Left,z",
            "left-overrun-space=Down,Return,Left,Left,Left,Left,Up,Left,Left,Left,space",
        ],
        slot_source=["1=data/public_savedata/flack3r/savedat2.dat"],
        case_aliases=True,
        staged_kind="public predecessor left-overrun activation branch-state watch",
        prefix=DEFAULT_PREFIX,
        out_dir=OUT,
        output_prefix=OUTPUT_PREFIX,
    )
    summary = build_summary(args)
    summary["objective"] = "public predecessor left-overrun activation poll with branch-state watch values"
    summary["branchStateWatchValues"] = BRANCH_STATE_WATCH_VALUES
    write_outputs(summary, OUT, OUTPUT_PREFIX)
    print(f"wrote predecessor left-overrun branch-state poll -> {OUT / (OUTPUT_PREFIX + '.html')}")


if __name__ == "__main__":
    main()
