<?php


use App\Http\Controllers\admin\ActivityReward;
use App\Http\Controllers\admin\ActivityUser;
use App\Http\Controllers\admin\Backflow;
use App\Http\Controllers\admin\Home;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\admin\Admin;
use App\Http\Controllers\admin\Upload;
use App\Http\Controllers\admin\Wallet;
use App\Http\Controllers\admin\Withdraw;
use App\Http\Controllers\admin\Room;
use App\Http\Controllers\admin\User;
use App\Http\Controllers\admin\Balance;
use App\Http\Controllers\admin\Config;
use App\Http\Controllers\admin\Sync;
use App\Http\Controllers\admin\Menu;
use App\Http\Controllers\admin\Role;
use App\Http\Controllers\admin\Game;
use App\Http\Controllers\admin\GameplayRule;
use App\Http\Controllers\admin\Issue;
use App\Http\Controllers\admin\Keyboard;
use App\Http\Controllers\admin\Lottery;
use App\Http\Controllers\admin\Bet;

use App\Http\Controllers\admin\Rebate;
use App\Http\Controllers\admin\PaymentOrder;
use App\Http\Controllers\admin\PcIssue;
use App\Http\Controllers\admin\Order;
use App\Http\Controllers\admin\Operation;
use App\Http\Controllers\admin\Banner;
use App\Http\Controllers\admin\LhcOrder;
use App\Http\Controllers\admin\LhcNumber;
use App\Http\Controllers\admin\LhcLottery;
use App\Http\Controllers\admin\Sport;
use App\Http\Controllers\admin\Level;
use App\Http\Controllers\admin\YueBao;
use App\Http\Controllers\admin\RechargeChannel;
use App\Http\Controllers\admin\UserFeedback;
use App\Http\Controllers\admin\SportGame;
use App\Http\Controllers\admin\SportGameOrder;
use App\Http\Controllers\admin\JisuGame;
use App\Http\Controllers\admin\JisuGameOrder;
use App\Http\Controllers\admin\JisuLottery;
use App\Http\Controllers\admin\Egame;
use App\Http\Controllers\admin\Online;
use App\Http\Controllers\admin\Funds;
use App\Http\Controllers\admin\ManualAudit;
use App\Http\Controllers\admin\ThirdPartyDeposit;

Route::post('/login', [Admin::class, 'login']);
Route::get('/test', [Wallet::class, 'test']);
Route::get('/image', [Lottery::class, 'generate']);
// Route::get('/batch', [Withdraw::class, 'batch']);

Route::prefix('/sync')->group(function () {
    Route::get('/collect', [Sync::class, 'collect']);
    Route::get('/recharge', [Sync::class, 'recharge']);
    Route::get('/settle', [Sync::class, 'settle']);
    Route::get('/five', [Sync::class, 'five']);
    Route::get('/close', [Sync::class, 'close']);
    Route::get('/cd', [Sync::class, 'cd']);
    Route::get('/exchange', [Sync::class, 'exchange']);
});

Route::get('/fake', [Bet::class, 'fake']);
Route::get('/fakel', [Issue::class, 'fakeLotteryDraw']);


Route::middleware(['admin.jwt'])->group(function () {


    Route::middleware(['check.button.uri'])->group(function () {
        Route::get('/menu/mineMenu', [Menu::class, 'mineMenu']); // 我的菜单
        Route::post('/menu/check', [Menu::class, 'check']); // 接口权限
        Route::get('/menu/tree', [Menu::class, 'tree']); // 菜单按钮树

        Route::prefix('/backflow')->group(function () {
            Route::get('/', [Backflow::class, 'index']);
            Route::post("/grant", [Backflow::class, 'grant']);

        });

        Route::prefix('/ActivityUser')->group(function () {
            Route::get('/', [ActivityUser::class, 'index']);
            Route::post("/gift", [ActivityUser::class, 'gift']);
            Route::post("/finish", [ActivityUser::class, 'finish']);
        });

        Route::prefix('/ActivityReward')->group(function () {
            Route::get('/', [ActivityReward::class, 'index']);
            Route::post('/submit', [ActivityReward::class, 'store']);
            Route::post('/delete', [ActivityReward::class, 'destroy']);
        });


        Route::prefix('/pcIssue')->group(function () {
            Route::get('/', [PcIssue::class, 'index']);
            Route::post('/preDraw', [PcIssue::class, 'preDraw']);
        });

        Route::prefix('/home')->group(function () {
            Route::get("/", [Home::class, 'index']);
        });

        Route::prefix("/paymentOrder")->group(function () {
            Route::get('/', [PaymentOrder::class, 'index']);
            Route::get('/check', [PaymentOrder::class, 'check']);
            Route::post('/audit', [PaymentOrder::class, 'audit']);
            Route::post('/setPayData', [PaymentOrder::class, 'setPayData']);
            Route::post('/manualAudit', [PaymentOrder::class, 'manualAudit']);
            Route::post('/setIsLocked', [PaymentOrder::class, 'setIsLocked']);
            Route::get('/unProcessed', [PaymentOrder::class, 'unProcessed']);
        });


        Route::prefix('/rebate')->group(function () {
            Route::get('/', [Rebate::class, 'index']);
            Route::post('/submit', [Rebate::class, 'store']);
        });


        Route::post("/setPassword", [Admin::class, 'setPassword']);
        Route::get('/index', [Admin::class, 'index']);
        Route::post('/submit', [Admin::class, 'store']);
        Route::post('/delete', [Admin::class, 'destroy']);

        // 关键字回复路由
        Route::prefix('/keyboard')->group(function () {
            Route::get('/', [Keyboard::class, 'index']);
            Route::post('/submit', [Keyboard::class, 'store']);
            Route::post('/delete', [Keyboard::class, 'destroy']);
        });

        // 期数路由
        Route::prefix('/issue')->group(function () {
            Route::get('/', [Issue::class, 'index']);
            Route::get('/abnormal', [Issue::class, 'abnormal']);
            Route::post('/submit', [Issue::class, 'store']);
            Route::post('/betting', [Issue::class, 'betting']);
            Route::post('/close', [Issue::class, 'close']);
            Route::post('/failure', [Issue::class, 'failure']);
            Route::post('/lotteryDraw', [Issue::class, 'lotteryDraw']); // 开奖
            Route::post('/delete', [Issue::class, 'destroy']); // 删除
        });
        // 投注记录
        Route::prefix('/bet')->group(function () {
            Route::get('/', [Bet::class, 'index']);
        });

        // 玩法规则路由
        Route::prefix('/gameplayRule')->group(function () {
            Route::get('/', [GameplayRule::class, 'index']);
            Route::post('/submit', [GameplayRule::class, 'store']); // 游戏规则写入
            Route::get('/cache', [GameplayRule::class, 'info']); // 游戏规则缓存读取
            Route::post('/delete', [GameplayRule::class, 'destroy']); // 删除
        });

        Route::prefix('/withdraw')->group(function () {
            Route::get('/', [Withdraw::class, 'index']);
            Route::get('/rmb', [Withdraw::class, 'rmb']);
            Route::post('setStatus', [Withdraw::class, 'setStatus']);
            Route::post('/setNote', [Withdraw::class, 'setNote']);
            Route::post('/setRmbNote', [Withdraw::class, 'setRmbNote']);
            Route::post('/setIsLocked', [Withdraw::class, 'setIsLocked']);


        });

        Route::prefix('/game')->group(function () {
            Route::get('/', [Game::class, 'index']);
            Route::post('/update', [Game::class, 'update']);
            Route::post('/delete', [Game::class, 'destroy']);
        });

        Route::prefix('/room')->group(function () {
            Route::get('/', [Room::class, 'index']);
            Route::get('/details', [Room::class, 'details']);
            Route::post('/setScore', [Room::class, 'setScore']);
            Route::post('/completed', [Room::class, 'completed']);
        });

        Route::prefix('/config')->group(function () {
            Route::get('/pcConfig', [Config::class, 'pcConfig']);
            Route::post('/pc28Switch', [Config::class, 'pc28Switch']);
            Route::get('/gameList', [Config::class, 'gameList']);


            Route::get('/getAll', [Config::class, 'getAll']);
            Route::get('/get', [Config::class, 'get']);
            Route::post('/set', [Config::class, 'set']);
            Route::post('/sendChannelMessage', [Config::class, 'sendChannelMessage']);
            // Route::post('/sendChannelVideo', [Config::class, 'sendChannelVideo']);
            Route::get('/', [Config::class, 'index']);
            Route::post('/submit', [Config::class, 'store']); // 
            Route::post('/delete', [Config::class, 'destroy']); // 删除
            Route::post('/setField', [Config::class, 'setField']);
        });

        Route::prefix('/balance')->group(function () {
            Route::get('/log', [Balance::class, 'log']);
        });

        Route::prefix('/funds')->group(function () {
            Route::get('/summary', [Funds::class, 'summary']);
        });

        Route::prefix('/manualAudit')->group(function () {
            Route::get('/', [ManualAudit::class, 'index']);
            Route::get('/detail', [ManualAudit::class, 'detail']);
            Route::post('/topUp', [ManualAudit::class, 'topUp']);
            Route::post('/debit', [ManualAudit::class, 'debit']);
        });

        Route::prefix('/thirdPartyDeposit')->group(function () {
            Route::get('/', [ThirdPartyDeposit::class, 'index']);
            Route::get('/detail', [ThirdPartyDeposit::class, 'detail']);
        });

        Route::prefix('/wallet')->group(function () {
            Route::get('/', [Wallet::class, 'index']);
            Route::post('/topUp', [Wallet::class, 'topUp']);
            Route::post('/verifyRecharge', [Wallet::class, 'verifyRecharge']);
            Route::get('/getPendingTasks', [Wallet::class, 'getPendingTasks']);
            Route::get('/getChangeTypes', [Wallet::class, 'getChangeTypes']);
            Route::post('/debiting', [Wallet::class, 'debiting']);
            Route::post('/orderDebiting', [Wallet::class, 'orderDebiting']);
            Route::post('/orderTopUp', [Wallet::class, 'orderTopUp']);

            Route::get("/bankList", [Wallet::class, 'bankList']);
            Route::get("/address", [Wallet::class, 'address']);
            Route::get("/withdrawChannel", [Wallet::class, 'withdrawChannel']);
            Route::get("/getChannel", [Wallet::class, 'getChannel']);
            

        });

        Route::prefix('/rechargeChannel')->group(function () {
            Route::get("/list", [RechargeChannel::class, 'list']);
            Route::post("/update", [RechargeChannel::class, 'update']);
            Route::get("/groupList", [RechargeChannel::class, 'groupList']);
            Route::post("/updateGroup", [RechargeChannel::class, 'updateGroup']);
            Route::get("/getChannel", [RechargeChannel::class, 'getChannel']);

        });

        Route::prefix('/user')->group(function () {
            Route::get('/', [User::class, 'index']);
            Route::get('/address', [User::class, 'address']);
            Route::post('/merge', [User::class, 'merge']);
            Route::post('/setNote', [User::class, 'setNote']);
            Route::post('/banned', [User::class, 'banned']);
            Route::get('/loginLog', [User::class, 'loginLog']);
            Route::get('/registerTrend', [User::class, 'registerTrend']);
            Route::get('/registerDomain', [User::class, 'registerDomain']);
            Route::post('/setRechargeChannelGroup', [User::class, 'setRechargeChannelGroup']);
            Route::post('/setPassword', [User::class, 'setPassword']);
            Route::get('/thirdGame/detail', [User::class, 'thirdGameDetail']);
            Route::post('/thirdGame/recycle', [User::class, 'recycleThirdGameBalance']);
            Route::get('/thirdGame/recycleRecords', [User::class, 'thirdGameRecycleRecords']);
            Route::post('/thirdGame/recycleResolve', [User::class, 'resolveThirdGameRecycle']);
        });

        Route::prefix('/online')->group(function () {
            Route::get('/users', [Online::class, 'users']);
            Route::get('/newUserSummary', [Online::class, 'newUserSummary']);
            Route::get('/platformCount', [Online::class, 'platformCount']);
        });

        Route::prefix('/userFeedback')->group(function () {
            Route::get('/list', [UserFeedback::class, 'list']);
        });

        Route::prefix('/menu')->group(function () {
            Route::get('/', [Menu::class, 'index']);
            Route::post('/submit', [Menu::class, 'store']);
            Route::post('/delete', [Menu::class, 'destroy']);
            Route::get('/all', [Menu::class, 'all']);

        });

        Route::prefix('/role')->group(function () {
            Route::get('/', [Role::class, 'index']);
            Route::post('/submit', [Role::class, 'store']);
            Route::post('/delete', [Role::class, 'destroy']);
            Route::get('/all', [Role::class, 'all']);

        });

        Route::prefix('/order')->group(function () {
            Route::post('/refund', [Order::class, 'refund']);
            Route::get('/list', [Order::class, 'list']);
            Route::get('/info', [Order::class, 'info']);
        });
        Route::prefix('/operation')->group(function () {
            Route::get('/exchangeList', [Operation::class, 'exchangeList']);
            Route::get('/index', [Operation::class, 'index']);
        });
        Route::prefix('/banner')->group(function () {
            Route::get('/index', [Banner::class, 'index']);
            Route::post('/update', [Banner::class, 'update']);
            Route::get('/delete', [Banner::class, 'delete']);
        });
        
        Route::prefix('/lhcOrder')->group(function () {
            Route::get('/list', [LhcOrder::class, 'list']);
            Route::get('/info', [LhcOrder::class, 'info']);
            Route::post('/refund', [LhcOrder::class, 'refund']);
        });
        Route::prefix('/lhcNumber')->group(function () {
            Route::get('/list', [LhcNumber::class, 'list']);
            Route::post('/setOdds', [LhcNumber::class, 'setOdds']);
        });
        Route::prefix('/lhcLottery')->group(function () {
            Route::get('/list', [LhcLottery::class, 'list']);
            Route::post('/setAdvanceCode', [LhcLottery::class, 'setAdvanceCode']);
        });

        
        Route::prefix('/sport')->group(function () {
            Route::get('/list', [Sport::class, 'list']);
            Route::get('/info', [Sport::class, 'info']);
            Route::post('/setStatus', [Sport::class, 'setStatus']);
            Route::post('/setOddsLocked', [Sport::class, 'setOddsLocked']);
            Route::post('/getFixtures', [Sport::class, 'getFixtures']);
            Route::post('/setValuesLocked', [Sport::class, 'setValuesLocked']);
            Route::post('/setOdds', [Sport::class, 'setOdds']);
            Route::get('/oddsList', [Sport::class, 'oddsList']);
        });

        Route::prefix('/level')->group(function () {
            Route::get('/list', [Level::class, 'list']);
            Route::post('/update', [Level::class, 'update']);
            Route::get('/delete', [Level::class, 'delete']);
        });

        Route::prefix('/yuebao')->group(function () {
            Route::get('/item', [YueBao::class, 'item']);
            Route::get('/log', [YueBao::class, 'log']);
        });

        
        Route::prefix('/sportGame')->group(function () {
            Route::get('/list', [SportGame::class, 'list']);
            Route::post('/setOdds', [SportGame::class, 'setOdds']);
        });
        Route::prefix('/sportGameOrder')->group(function () {
            Route::get('/list', [SportGameOrder::class, 'list']);
            Route::get('/info', [SportGameOrder::class, 'info']);
            Route::post('/refund', [SportGameOrder::class, 'refund']);
        });
        
        Route::prefix('/jisuGame')->group(function () {
            Route::get('/list', [JisuGame::class, 'list']);
            Route::post('/setOdds', [JisuGame::class, 'setOdds']);
        });
        Route::prefix('/jisuGameOrder')->group(function () {
            Route::get('/list', [JisuGameOrder::class, 'list']);
            Route::get('/info', [JisuGameOrder::class, 'info']);
            Route::post('/refund', [JisuGameOrder::class, 'refund']);
        });
        Route::prefix('/jisuLottery')->group(function () {
            Route::get('/list', [JisuLottery::class, 'list']);
            Route::post('/setAdvanceCode', [JisuLottery::class, 'setAdvanceCode']);
        });

        Route::prefix('/egame')->group(function () {
            Route::get('/items', [Egame::class, 'items']);
            Route::get('/options', [Egame::class, 'options']);
            Route::post('/update', [Egame::class, 'update']);
            Route::post('/setStatus', [Egame::class, 'setStatus']);
            Route::post('/delete', [Egame::class, 'delete']);
        });
    });


    Route::prefix('/upload')->group(function () {
        Route::post('/uploadFile', [Upload::class, 'store']);
        Route::post('/uploadVideo', [Upload::class, 'video']);
    });


});
