#!/usr/bin/env python3
"""Pasang carousel Flek (3 slide) ke IG TSC + Threads TSC — 12 Sep 09:00 WIB."""
import sys, json, urllib.request
sys.path.insert(0, "/home/mantapman/.openclaw/workspace-atun")
from repliz_client import HEADERS, BASE

IG_TSC = "6a86a7e062caae1e04ff8244"      # The Skin Code Clinic IG
TH_TSC = "6a4bbc5920e4f4f195e52960"      # TSC Threads (@dniclinic_krian)
IMG = "https://mantapserver.tail3947bb.ts.net/openclaw-img/"
AT = "2026-09-12T02:00:00.000Z"  # 09:00 WIB 12 Sep

SLIDES = [
    {"url": IMG + "tsc_flek_01.png", "type": "image", "alt": "tsc_flek_01"},
    {"url": IMG + "tsc_flek_02.png", "type": "image", "alt": "tsc_flek_02"},
    {"url": IMG + "tsc_flek_03.png", "type": "image", "alt": "tsc_flek_03"},
]

CAP = """Flek di wajah bikin nggak percaya diri? Ternyata mencegahnya bisa dimulai dari kebiasaan sederhana! ✨

3 KEBIASAAN UNTUK MENCEGAH FLEK:
1️⃣ Gunakan sunscreen setiap pagi — bahkan saat beraktivitas di dalam ruangan
2️⃣ Ulangi pemakaian (reapply) saat banyak beraktivitas di luar ruangan
3️⃣ Hindari memencet jerawat dan iritasi berulang — ini penyebab bekas gelap yang paling sering

RAWAT KULIT DENGAN LEMBUT:
• Pilih skincare yang sesuai kebutuhan kulit
• Jaga kelembapan kulit setiap hari
• Konsultasikan flek yang menetap dengan ahlinya

Rawat kulit wajah dimulai dari kebiasaan sederhana. Kalau flek sudah menetap, jangan dipaksa dengan produk keras — biar dokter spesialis yang menentukan penanganan paling tepat untuk kulitmu.

Kamu punya pengalaman dengan flek? Atau tips lain mencegahnya? Cerita di komentar, yuk diskusi! 👇

📲 Konsultasi & booking via WhatsApp: 0851-1744-4417

#theskincodeclinic #flek #hiperpigmentasi #dokterkulit #klinikkulit #perawatankulit #kulitsehat #sunscreen #skincare #estetikamedis"""

ok = fail = 0
for accid, nm in [(IG_TSC, "IG TSC"), (TH_TSC, "Threads TSC")]:
    payload = {
        "accountId": accid,
        "title": "The Skin Code Clinic — Carousel Flek",
        "description": CAP,
        "topic": "Edukasi Kulit",
        "type": "album",
        "medias": SLIDES,
        "scheduleAt": AT,
        "replies": [],
    }
    req = urllib.request.Request(f"{BASE}/public/schedule",
                                 data=json.dumps(payload).encode(),
                                 headers={**HEADERS, "Content-Type": "application/json"})
    try:
        with urllib.request.urlopen(req, timeout=30) as r:
            res = json.load(r)
        ok += 1
        print(f"  ✅ {nm} | 12 Sep 09:00 WIB | id={res.get('_id') or res.get('id') or '?'}")
    except Exception as e:
        fail += 1
        print(f"  ❌ {nm}: {e}")
print(f"\n📊 Total: {ok} OK, {fail} gagal")
