#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""uji_hasil_ig_teks.py — laporan HASIL uji post TEKS di IG StudioSoft.

Jadwal uji: 6abefbfd07008e0e9147d429 (teks, 3 Okt 2026 13:00 WIB).
Tujuan: membuktikan apakah IG StudioSoft menerima post teks lewat Repliz
(catatan lama: post teks ke akun Instagram error "invalid postId: unsupported type schedule").
Dipakai oleh cron satu kali `ig-teks-check`. Selalu mengeluarkan satu baris laporan.
"""
from repliz_client import get_client

ID = "6abefbfd07008e0e9147d429"

c = get_client()
d = c.get(f"/public/schedule/{ID}")
d = d.get("data") or d
status = d.get("status")
err = d.get("errorMessage") or "-"
post = d.get("postId") or "-"
title = d.get("title") or "-"

if status == "success":
    print(f"✅ Uji post TEKS di IG StudioSoft BERHASIL tayang (postId {post}). "
          f"Artinya Repliz + IG sudah menerima format teks → pipeline teks IG bisa dibuka.")
elif status == "error":
    print(f"⚠️ Uji post TEKS di IG StudioSoft GAGAL. Pesan error: {err}. "
          f"Kesimpulan: format teks belum bisa dipakai untuk IG lewat Repliz → tetap pakai carousel/reel.")
else:
    print(f"⚠️ Uji post TEKS di IG StudioSoft belum jelas: status masih '{status}' padahal jam tayang "
          f"(3 Okt 13:00 WIB) sudah lewat. Jadwal: {title}.")
