<?php
session_start();
$_SESSION['user_id'] = 1;
$_SESSION['role'] = 'admin';
chdir('/home/dimark93/public_html/supercerebro');
$_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['HTTP_HOST'] = 'dimark.co';
$_SERVER['SCRIPT_NAME'] = '/supercerebro/api/wp-theme-generator.php';
$_SERVER['HTTPS'] = 'on';

// Simular body JSON
$GLOBALS['_INPUT'] = json_encode(['action' => 'generate_from_proposal', 'proposal_id' => 31]);

// Override file_get_contents para php://input
function file_get_contents($file) {
    if ($file === 'php://input') return $GLOBALS['_INPUT'];
    return \file_get_contents($file);
}

ob_start();
require 'api/wp-theme-generator.php';
$out = ob_get_clean();
echo $out . "\n";
