<?php
declare(strict_types=1);
require_once dirname(__DIR__) . '/_app_guard.php';
app_guard_validate();
header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
$file = dirname(__DIR__) . '/thefulltv_pagamentos.json';
if (is_file($file)) {
    $raw = (string)@file_get_contents($file);
    $json = json_decode($raw, true);
    if (is_array($json)) {
        if (!isset($json['pagamentos']) || !is_array($json['pagamentos'])) $json['pagamentos'] = [];
        echo json_encode($json, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
        exit;
    }
}
echo json_encode(['status' => 'ok', 'pagamentos' => []], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
