<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Inertia\Inertia;

class BettingRecordController extends Controller
{
    public function index(Request $request)
    {
        $category = $request->get('category', 'live');
        $vendor = $request->get('vendor', 'all');
        $type = $request->get('type', 'all');

        $vendors = [
            'live' => ['All', 'Evolution', 'Playtech', 'SEXY CASINO', 'ViA CASINO', 'Ezugi'],
            'poker' => ['All', 'Jili', 'Kings Poker', 'Baison Poker', 'KingMidas'],
            'fish' => ['All', 'FA CHAI Gaming', 'Spadegaming', 'BTGaming', 'Baison Poker', 'Micro Gaming'],
            'sports' => ['All', '9wickets', 'LuckySports', 'SV388', 'TF', 'FB SPORTS'],
            'lottery' => ['All', 'TCG Sea Lottery'],
        ];

        $types = [
            'live' => ['All', 'Lose', 'Win', 'Tie'],
            'poker' => ['All'],
            'fish' => ['All'],
            'sports' => ['Unsettled', 'Settled'],
            'lottery' => ['Unsettled', 'Settled'],
        ];

        $summary = match ($category) {
            'sports' => [
                'bet_amount' => '0.00',
                'valid_bet' => null,
                'winnings' => null,
                'profit_loss' => null,
            ],
            'lottery' => [
                'bet_amount' => '0.00',
                'valid_bet' => '0.00',
                'winnings' => '0.00',
                'profit_loss' => null,
            ],
            default => [
                'bet_amount' => '0.00',
                'valid_bet' => '0.00',
                'winnings' => '0.00',
                'profit_loss' => '0.00',
            ]
        };

        return Inertia::render('CkComponents/Profile/BettingRecord', [
            'filters' => [
                'category' => $category,
                'vendor' => $vendor,
                'type' => $type,
                'dateLabel' => '04/04 00:00:00- 04/04 23:59:59',
            ],
            'vendors' => $vendors,
            'types' => $types,
            'records' => [],
            'summary' => $summary,
        ]);
    }
}