<?php
declare(strict_types=1);

if (!function_exists('mocker_config_env')) {
    
    function mocker_config_env(string $key, string $default = '')
    {
        $v = getenv($key);
        if ($v !== false && $v !== '') {
            return (string) $v;
        }

        return $default;
    }
}

if (is_readable(__DIR__ . '/config.local.php')) {
    require_once __DIR__ . '/config.local.php';
}

if (!defined('SITE_ADMIN_PASSWORD_HASH')) {
    define('SITE_ADMIN_PASSWORD_HASH', mocker_config_env('MOCKER_ADMIN_PASSWORD_HASH', ''));
}
if (!defined('SITE_ADMIN_PANEL_SECRET')) {
    define('SITE_ADMIN_PANEL_SECRET', mocker_config_env('MOCKER_ADMIN_PANEL_SECRET', ''));
}
if (!defined('SITE_TELEGRAM_BOT_TOKEN')) {
    define('SITE_TELEGRAM_BOT_TOKEN', mocker_config_env('MOCKER_TELEGRAM_BOT_TOKEN', ''));
}
if (!defined('SITE_TELEGRAM_BOT_USERNAME')) {
    define('SITE_TELEGRAM_BOT_USERNAME', mocker_config_env('MOCKER_TELEGRAM_BOT_USERNAME', ''));
}
if (!defined('SITE_TELEGRAM_WEBHOOK_SECRET')) {
    define('SITE_TELEGRAM_WEBHOOK_SECRET', mocker_config_env('MOCKER_TELEGRAM_WEBHOOK_SECRET', ''));
}

if (!defined('SPORT_RAPIDAPI_KEY')) {
    define('SPORT_RAPIDAPI_KEY', mocker_config_env('MOCKER_SPORT_RAPIDAPI_KEY', ''));
}
if (!defined('SPORT_RAPIDAPI_HOST')) {
    define('SPORT_RAPIDAPI_HOST', mocker_config_env('MOCKER_SPORT_RAPIDAPI_HOST', 'sportapi7.p.rapidapi.com'));
}

if (!defined('SPORT_EVENT_PATH_TEMPLATE')) {
    define('SPORT_EVENT_PATH_TEMPLATE', mocker_config_env('MOCKER_SPORT_EVENT_PATH_TEMPLATE', '/api/v1/event/{id}'));
}

if (!defined('SPORT_SCHEDULE_PATH_TEMPLATE')) {
    define('SPORT_SCHEDULE_PATH_TEMPLATE', mocker_config_env('MOCKER_SPORT_SCHEDULE_PATH_TEMPLATE', '/api/v1/sport/football/scheduled-events/{date}'));
}

if (!defined('SPORT_TEAM_LOGO_PATH_TEMPLATE')) {
    define('SPORT_TEAM_LOGO_PATH_TEMPLATE', mocker_config_env('MOCKER_SPORT_TEAM_LOGO_PATH_TEMPLATE', '/api/v1/team/{id}/image'));
}

if (!defined('SPECIAL_ODDS_CRON_TOKEN')) {
    define('SPECIAL_ODDS_CRON_TOKEN', mocker_config_env('MOCKER_SPECIAL_ODDS_CRON_TOKEN', ''));
}

if (!defined('YOUTUBE_API_KEY')) {
    define('YOUTUBE_API_KEY', mocker_config_env('MOCKER_YOUTUBE_API_KEY', ''));
}

if (!defined('EXTERNAL_PLAYERS_API_URL')) {
    define('EXTERNAL_PLAYERS_API_URL', mocker_config_env('MOCKER_EXTERNAL_PLAYERS_API_URL', ''));
}
if (!defined('EXTERNAL_PLAYERS_BEARER_TOKEN')) {
    define('EXTERNAL_PLAYERS_BEARER_TOKEN', mocker_config_env('MOCKER_EXTERNAL_PLAYERS_BEARER_TOKEN', ''));
}
if (!defined('EXTERNAL_PLAYERS_X_CLIENT')) {
    define('EXTERNAL_PLAYERS_X_CLIENT', mocker_config_env('MOCKER_EXTERNAL_PLAYERS_X_CLIENT', ''));
}
if (!defined('EXTERNAL_PLAYERS_ORIGIN')) {
    define('EXTERNAL_PLAYERS_ORIGIN', mocker_config_env('MOCKER_EXTERNAL_PLAYERS_ORIGIN', ''));
}
if (!defined('EXTERNAL_PLAYERS_REFERER')) {
    define('EXTERNAL_PLAYERS_REFERER', mocker_config_env('MOCKER_EXTERNAL_PLAYERS_REFERER', ''));
}
if (!defined('EXTERNAL_PLAYERS_TIMEOUT_SEC')) {
    define('EXTERNAL_PLAYERS_TIMEOUT_SEC', (int) mocker_config_env('MOCKER_EXTERNAL_PLAYERS_TIMEOUT_SEC', '15'));
}
if (!defined('EXTERNAL_PLAYERS_MAX_PAGES')) {
    define('EXTERNAL_PLAYERS_MAX_PAGES', (int) mocker_config_env('MOCKER_EXTERNAL_PLAYERS_MAX_PAGES', '120'));
}
if (!defined('EXTERNAL_PLAYERS_PER_PAGE')) {
    define('EXTERNAL_PLAYERS_PER_PAGE', (int) mocker_config_env('MOCKER_EXTERNAL_PLAYERS_PER_PAGE', '100'));
}
if (!defined('EXTERNAL_PLAYERS_SSL_VERIFY')) {
    define('EXTERNAL_PLAYERS_SSL_VERIFY', (int) mocker_config_env('MOCKER_EXTERNAL_PLAYERS_SSL_VERIFY', '0'));
}
if (!defined('EXTERNAL_PLAYERS_MAX_DURATION_SEC')) {
    define('EXTERNAL_PLAYERS_MAX_DURATION_SEC', (int) mocker_config_env('MOCKER_EXTERNAL_PLAYERS_MAX_DURATION_SEC', '300'));
}
if (!defined('EXTERNAL_PLAYERS_SYNC_ENABLED')) {
    define('EXTERNAL_PLAYERS_SYNC_ENABLED', mocker_config_env('MOCKER_EXTERNAL_PLAYERS_SYNC_ENABLED', '0') === '1');
}
if (!defined('EXTERNAL_PLAYERS_LOGIN_URL')) {
    define('EXTERNAL_PLAYERS_LOGIN_URL', mocker_config_env('MOCKER_EXTERNAL_PLAYERS_LOGIN_URL', ''));
}
if (!defined('EXTERNAL_PLAYERS_LOGIN_ENABLED')) {
    define('EXTERNAL_PLAYERS_LOGIN_ENABLED', mocker_config_env('MOCKER_EXTERNAL_PLAYERS_LOGIN_ENABLED', '1') === '1');
}
