#!/usr/bin/env python3
"""Poll public predecessor direction sweeps with active descriptor order 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_patched_selector_active_order_poll import ACTIVE_ORDER_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_direction_sweep_active_order_poll"


def main() -> None:
    runtime_input.ROUTE_WATCH_VALUES = dict(runtime_input.ROUTE_WATCH_VALUES)
    runtime_input.ROUTE_WATCH_VALUES.update(ACTIVE_ORDER_WATCH_VALUES)
    args = Namespace(
        startup_wait=18.0,
        hold=0.7,
        gap=0.25,
        interval=0.02,
        prelude="input-path",
        sequence=[
            "predecessor-right-sweep=Down,Return,Right,Right,Right,Right,Return",
            "predecessor-left-sweep=Down,Return,Left,Left,Left,Left,Return",
            "predecessor-up-sweep=Down,Return,Up,Up,Up,Up,Return",
            "predecessor-down-sweep=Down,Return,Down,Down,Down,Down,Return",
            "predecessor-right-run=Down,Return,Right,Right,Right,Right,Right,Right",
            "predecessor-left-run=Down,Return,Left,Left,Left,Left,Left,Left",
            "predecessor-up-run=Down,Return,Up,Up,Up,Up,Up,Up",
            "predecessor-down-run=Down,Return,Down,Down,Down,Down,Down,Down",
        ],
        slot_source=["1=data/public_savedata/flack3r/savedat2.dat"],
        case_aliases=True,
        staged_kind="public predecessor direction sweep active-order watch",
        prefix=DEFAULT_PREFIX,
        out_dir=OUT,
        output_prefix=OUTPUT_PREFIX,
    )
    summary = build_summary(args)
    summary["objective"] = "public predecessor direction sweep poll with active order/count watch values"
    summary["activeOrderWatchValues"] = ACTIVE_ORDER_WATCH_VALUES
    write_outputs(summary, OUT, OUTPUT_PREFIX)
    print(f"wrote predecessor direction sweep active-order poll -> {OUT / (OUTPUT_PREFIX + '.html')}")


if __name__ == "__main__":
    main()
