<?php
require_once '../classes/OMIE.php';

header('Content-Type: application/json; charset=utf-8');

if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    http_response_code(405);
    echo json_encode(['error' => 'Metodo no permitido']);
    exit;
}

$fechaInicio = $_POST['fecha_inicio'] ?? date('Y-m-d', strtotime('-60 days'));
$fechaFin = $_POST['fecha_fin'] ?? date('Y-m-d');
$marketType = $_POST['market_type'] ?? 'omie';

$omie = new OMIE();
echo json_encode($omie->getIntegrityAlerts($fechaInicio, $fechaFin, $marketType));
?>
