#!/usr/bin/env python3
"""hc43: cek kapan tiap artikel healthcare terakhir tampil di Threads SS (dari dump 21 Sep)."""
import json, sys
sys.path.insert(0, '/home/mantapman/.hermes/profiles/atun/workspace')
from repliz_client import ACC

docs = json.load(open('/tmp/repliz_all_20260921.json'))
ds = [(d.get('scheduleAt') or '')[:16] for d in docs if d.get('scheduleAt')]
print("docs:", len(docs), "range:", min(ds), "->", max(ds))

HC = ["rs-klinik-digital-marketing-2026", "google-business-profile-klinik", "social-media-rumah-sakit-efektif",
      "strategi-digital-marketing-rumah-sakit", "10-channel-digital-marketing-rumah-sakit",
      "9-contoh-konten-digital", "7-strategi-digital-marketing-rumah-sakit",
      "tips-seo-digital-marketing-surabaya", "7-aplikasi-mental-health",
      "strategi-seo-terbaik-untuk-klinik-kecantikan", "cara-klinik-kecantikan"]
for slug in HC:
    rows = []
    for d in docs:
        if d.get('accountId') != ACC.STUDIOSOFT_THREADS:
            continue
        t = " ".join([(d.get('description') or ''), (d.get('title') or '')])
        if slug in t:
            rows.append(((d.get('scheduleAt') or '')[:16], (d.get('status') or ''),
                         (d.get('type') or ''), len(d.get('medias') or [])))
    rows.sort()
    print("\n%s" % slug)
    for r in rows:
        print("   ", r)

print("\n=== Threads SS: semua entry tipe album (carousel) ===")
alb = []
for d in docs:
    if d.get('accountId') != ACC.STUDIOSOFT_THREADS:
        continue
    if (d.get('type') or '') == 'album':
        alb.append(((d.get('scheduleAt') or '')[:16], (d.get('status') or ''),
                    (d.get('title') or '')[:60]))
alb.sort()
for r in alb:
    print("   ", r)
