<?php
require_once dirname(__DIR__) . '/bootstrap/chairman_production_core_bootstrap.php';

$raceDate = isset($_GET['race_date']) ? $_GET['race_date'] : date('Y-m-d');
$venue = isset($_GET['venue']) ? $_GET['venue'] : '';
$raceNum = isset($_GET['race_num']) ? intval($_GET['race_num']) : 0;
$mode = isset($_GET['mode']) ? strtoupper($_GET['mode']) : 'BALANCED';

$result = $ChairmanProductionCore->buildCache($raceDate,$venue,$raceNum,$mode);
header('Content-Type: application/json; charset=utf-8');
echo json_encode($result, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
