<?php
declare(strict_types=1);
define('BASE_PATH', dirname(__DIR__));
require BASE_PATH . '/vendor/autoload.php';
\Dotenv\Dotenv::createUnsafeMutable(BASE_PATH)->load();
\Webman\Config::load(BASE_PATH . '/config', ['route', 'plugin']);
\Webman\ThinkOrm\ThinkOrm::start(null);

use app\dice\helper\AdminScopeHelper;
use app\dice\logic\reward_config\DiceRewardConfigLogic;
use plugin\saiadmin\app\cache\UserInfoCache;

$adminInfo = UserInfoCache::getUserInfo(123);
$logic = new DiceRewardConfigLogic();
$query = $logic->search([]);
AdminScopeHelper::applyConfigScope($query, $adminInfo, 1123);
$data = $query->order('id', 'asc')->select()->toArray();
echo 'controller-style all rows: ' . count($data) . PHP_EOL;
$nonBig = 0;
foreach ($data as $row) {
    if (($row['tier'] ?? '') !== 'BIGWIN') {
        $nonBig++;
    }
}
echo 'index tab rows (non-BIGWIN): ' . $nonBig . PHP_EOL;
echo 'bigwin tab rows: ' . (count($data) - $nonBig) . PHP_EOL;
