<?php

namespace App\Http\Controllers;

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

class RebateController extends Controller
{
    public function index(Request $request)
    {
        $timezone = 'Asia/Singapore'; // GMT+8
        $today = Carbon::now($timezone)->format('Y-m-d');

        $tab = $request->get('tab', 'manual');
        $from = $request->get('from', Carbon::now($timezone)->format('m/d'));
        $to = $request->get('to', Carbon::now($timezone)->format('m/d'));

        $manualRebate = [
            'date' => '2026-04-04',
            'slot' => '0.00',
            'live' => '0.00',
            'poker' => '0.00',
            'fish' => '0.00',
            'sports' => '0.00',
            'total' => '0.00',
            'can_claim' => false,
        ];

        $rebateHistory = [];

        return Inertia::render('CkComponents/RewardCenter/Rebate', [
            'filters' => [
                'tab' => $tab,
                'from' => $from,
                'to' => $to,
                'today' => $today,
            ],
            'manualRebate' => $manualRebate,
            'rebateHistory' => $rebateHistory,
            'timezoneLabel' => 'GMT + 8',
        ]);
    }
}