#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Dump caption 65 jadwal uky + 19/20 jadwal SS dari bank growth (untuk pelabelan ulang per isi)."""
import json

out = []

h1 = json.load(open("growth_threads_hasil_20261005.json"))
h2 = json.load(open("growth_threads_uky2_hasil.json"))

for x in h1 + h2:
    if x.get("status") in ("CREATED", "SKIP-slot-terisi", "SKIP-sudah-lewat"):
        out.append({"akun": x["akun"], "tgl": x["tgl"], "jam": x["jam"], "tipe": x["tipe"],
                    "id": x.get("id"), "text": x.get("text") or ""})

print("total:", len(out), "| uky:", sum(1 for o in out if o["akun"] == "uky"),
      "| ss:", sum(1 for o in out if o["akun"] != "uky"))
json.dump(out, open("label_ulang_bahan.json", "w"), ensure_ascii=False, indent=1)

for i, o in enumerate(out):
    print(f"\n### {i} | {o['akun']} {o['tgl']} {o['jam']:02d}:00 [{o['tipe']}] id={o['id']}")
    print(o["text"].replace("\n", " ⏎ "))
