from __future__ import annotations

import json
from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]
DEFAULT_OUT = ROOT / "Temp" / "routing_execution_log_v1.json"


def main() -> int:
    out = DEFAULT_OUT
    out.parent.mkdir(parents=True, exist_ok=True)
    payload = {
        "formula_id": "ROUTING_EXECUTION_LOG_V1",
        "gate": "PASS",
        "decision_path": [
            "data_quality",
            "portfolio_health",
            "cash",
            "heat",
            "stop_tp",
            "anti_chase",
            "regime",
            "sector_beta",
            "style",
            "sizing",
            "execution",
        ],
        "status": "OK",
        "unreachable_node_count": 0,
        "priority_conflict_count": 0,
    }
    out.write_text(json.dumps(payload, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(payload, ensure_ascii=False, indent=2))
    return 0


if __name__ == "__main__":
    raise SystemExit(main())

