<?php
date_default_timezone_set('America/Guatemala');
ini_set('display_errors', 0);
error_reporting(E_ALL);
$config = require dirname(__DIR__, 2) . '/db_config.php';
define('DB_HOST', $config['host']);
define('DB_NAME', $config['dbname']);
define('DB_USER', $config['user']);
define('DB_PASS', $config['pass']);
define('DB_PORT', $config['port']);
define('DB_CHARSET', $config['charset']);

$assetVersion = '2026053102';

function getDBConnection() {
    static $pdo = null;
    if ($pdo === null) {
        require_once dirname(__DIR__, 2) . '/dual_pdo.php';
        $config = [
            'host' => DB_HOST,
            'port' => DB_PORT,
            'dbname' => DB_NAME,
            'user' => DB_USER,
            'pass' => DB_PASS,
            'charset' => DB_CHARSET
        ];
        $pdo = getDualConnection($config);
        $pdo->exec("SET time_zone = '-06:00'");
    }
    return $pdo;
}
