<?php
include "../../function/connect.php";
// atau
$DEBUG_MODE = false;
define('DEBUG_API', false);

/*************************
 * CACHE CONFIG
 *************************/
define('CACHE_ENABLE', true);          // ON/OFF cache
define('CACHE_ALLOW_REFRESH', false);  // false = JANGAN ambil data API
define('CACHE_TIME', 300);             // 5 menit (dipakai kalau refresh ON)

$query99 = "SELECT endpoint, agent_code, agent_token FROM tb_api LIMIT 1";
$result = mysqli_query($koneksi, $query99);

if (!$result) {
    die("Query error: " . mysqli_error($koneksi));
}

if (mysqli_num_rows($result) == 0) {
    die("Data tb_api kosong");
}

$api = mysqli_fetch_assoc($result);

$apiConfig = [
    'endpoint'    => $api['endpoint'],
    'agent_code'  => $api['agent_code'],
    'agent_token' => $api['agent_token'],
];

/***********************
 * PROVIDER
 ***********************/
$id_provider = strtoupper($_GET['provider'] ?? 'PRAGMATIC');

$allowed_provider = [
    'PRAGMATIC',
    'HABANERO',
    'BOOONGO',
    'PLAYSON',
    'CQ9',
    'EVOPLAY',
    'TOPTREND',
    'DREAMTECH',
    'PGSOFT',
    'REELKINGDOM',
    'FATPANDA',
    'PRAGMATICLIVE',
    'SPORTSBOOK',
    'SPRIBE'
    
];

if (!in_array($id_provider, $allowed_provider, true)) {
    exit('PROVIDER TIDAK VALID');
}

/************************
 * PRIORITAS GAME
 ************************/
$priorityGames = [
    'starlight princess super scatter',
    'gates of olympus super scatter',
    'mahjong wins 3',
    'mahjong ways 2',
    'mahjong ways',
    'wild bandito',
    'wild bounty showdown',
    'sweet bonanza',
    'gates of olympus',
    
    //CASINO
    'sicbo',
    'mega_sic_bo',
    'mega_wheel',
    'auto roulette'
];

$playersSetting = [
    'starlight princess super scatter' => [100, 200],
    'gates of olympus super scatter'   => [200, 250],
    'gates of olympus' => [100, 150],
    'sweet bonanza'    => [20, 80],
    'starlight'        => [80, 100],
    'mahjong ways'     => [1500, 1800],
    'mahjong ways 2'   => [2000, 2300],
    'wild bandito'     => [300, 400],
    'wild bounty showdown'   => [100, 120],
    
    //CASINO
    'sicbo' => [600, 700],
    'mega_sic_bo' => [1000, 1200],
    'mega_wheel'   => [200, 250],
];

