import json, sys
sys.path.insert(0, '/home/mantapman/.hermes/profiles/atun/workspace')
from repliz_client import ACC

docs = json.load(open('/tmp/hc70_sched.json'))
names = {ACC.STUDIOSOFT_THREADS: 'THREADS', ACC.STUDIOSOFT_LINKEDIN: 'LINKEDIN',
         ACC.STUDIOSOFT_FB: 'FACEBOOK', ACC.STUDIOSOFT_IG: 'IG'}
rows = {}
for d in docs:
    a = names.get(d.get('accountId'))
    if not a:
        continue
    st = (d.get('status') or '').lower()
    at = str(d.get('scheduleAt'))[:16]
    if at < '2026-10-18':
        continue
    if st not in ('pending', 'scheduled', 'draft'):
        continue
    rows.setdefault(a, []).append((at, d.get('type'), (d.get('title') or '')[:45], d.get('_id')))
for a in ('THREADS', 'LINKEDIN', 'FACEBOOK'):
    print('==', a, len(rows.get(a, [])))
    for r in sorted(rows.get(a, []))[:22]:
        print('  ', r)
