@extends('layouts.admin', ['heading' => 'Repair Tools'])

@section('content')
    @if(session('status'))
        <div class="mb-4 rounded bg-emerald-100 p-3 text-emerald-800">{{ session('status') }}</div>
    @endif

    <div class="space-y-4">
        <form method="POST" action="{{ route('admin.repair-tools.recalculate-wallet') }}" class="rounded bg-white p-4 shadow">
            @csrf
            <div class="mb-2 font-semibold">Recalculate Wallet</div>
            <input name="user_id" placeholder="User ID (optional)" class="mr-2 rounded border p-2" />
            <button class="rounded bg-slate-900 px-4 py-2 text-white">Run</button>
        </form>

        <form method="POST" action="{{ route('admin.repair-tools.rebuild-carry') }}" class="rounded bg-white p-4 shadow">
            @csrf
            <div class="mb-2 font-semibold">Rebuild Carry Forward</div>
            <button class="rounded bg-slate-900 px-4 py-2 text-white">Run</button>
        </form>

        <form method="POST" action="{{ route('admin.repair-tools.fix-tree') }}" class="rounded bg-white p-4 shadow">
            @csrf
            <div class="mb-2 font-semibold">Fix Tree</div>
            <input name="user_id" placeholder="Root User ID (optional)" class="mr-2 rounded border p-2" />
            <button class="rounded bg-slate-900 px-4 py-2 text-white">Run</button>
        </form>

        <form method="POST" action="{{ route('admin.repair-tools.retry-payouts') }}" class="rounded bg-white p-4 shadow">
            @csrf
            <div class="mb-2 font-semibold">Retry Failed Payouts</div>
            <input name="batch_id" placeholder="Batch ID (optional)" class="mr-2 rounded border p-2" />
            <button class="rounded bg-slate-900 px-4 py-2 text-white">Dispatch</button>
        </form>

        <form method="POST" action="{{ route('admin.repair-tools.retry-webhooks') }}" class="rounded bg-white p-4 shadow">
            @csrf
            <div class="mb-2 font-semibold">Retry Failed Webhooks</div>
            <input name="gateway" placeholder="Gateway (optional)" class="mr-2 rounded border p-2" />
            <button class="rounded bg-slate-900 px-4 py-2 text-white">Dispatch</button>
        </form>

        <form method="POST" action="{{ route('admin.repair-tools.maintenance.on') }}" class="rounded bg-white p-4 shadow">
            @csrf
            <div class="mb-2 font-semibold">Maintenance Mode</div>
            <div class="flex gap-2">
                <button class="rounded bg-amber-500 px-4 py-2 text-white">Enable</button>
            </div>
        </form>

        <form method="POST" action="{{ route('admin.repair-tools.maintenance.off') }}" class="rounded bg-white p-4 shadow">
            @csrf
            <div class="mb-2 font-semibold">Disable Maintenance</div>
            <button class="rounded bg-emerald-600 px-4 py-2 text-white">Disable</button>
        </form>
    </div>
@endsection
