<?php

use App\Http\Controllers\Admin\AuditLogController;
use App\Http\Controllers\Admin\DashboardController;
use App\Http\Controllers\Admin\EventController;
use App\Http\Controllers\Admin\EventRegistrationController;
use App\Http\Controllers\Admin\GameController as AdminGameController;
use App\Http\Controllers\Admin\ManualPaymentMethodController;
use App\Http\Controllers\Admin\ModerationController;
use App\Http\Controllers\Admin\PaymentProofReviewController;
use App\Http\Controllers\Admin\PlayerProfileController;
use App\Http\Controllers\Admin\SettingController;
use App\Http\Controllers\Admin\UserController;
use Illuminate\Support\Facades\Route;

Route::middleware(['auth', 'verified', 'active', 'admin'])
    ->prefix('admin')
    ->name('admin.')
    ->group(function () {
        Route::get('/', [DashboardController::class, 'index'])->name('dashboard');

        Route::get('users', [UserController::class, 'index'])->name('users.index');
        Route::get('users/{user}', [UserController::class, 'show'])->name('users.show');
        Route::post('users/{user}/suspend', [UserController::class, 'suspend'])->name('users.suspend');
        Route::post('users/{user}/reactivate', [UserController::class, 'reactivate'])->name('users.reactivate');

        Route::get('player-profiles', [PlayerProfileController::class, 'index'])->name('player-profiles.index');

        Route::resource('games', AdminGameController::class)->except(['show']);

        Route::get('events', [EventController::class, 'index'])->name('events.index');
        Route::get('events/create', [EventController::class, 'create'])->name('events.create');
        Route::post('events', [EventController::class, 'store'])->name('events.store');
        Route::get('events/{event}/edit', [EventController::class, 'edit'])->name('events.edit');
        Route::put('events/{event}', [EventController::class, 'update'])->name('events.update');
        Route::post('events/{event}/publish', [EventController::class, 'publish'])->name('events.publish');
        Route::post('events/{event}/cancel', [EventController::class, 'cancel'])->name('events.cancel');

        Route::get('events/{event}/registrations', [EventRegistrationController::class, 'index'])->name('events.registrations.index');
        Route::post('events/{event}/registrations/{registration}/approve', [EventRegistrationController::class, 'approve'])->name('events.registrations.approve');
        Route::post('events/{event}/registrations/{registration}/reject', [EventRegistrationController::class, 'reject'])->name('events.registrations.reject');
        Route::post('events/{event}/registrations/{registration}/promote', [EventRegistrationController::class, 'promoteWaitlist'])->name('events.registrations.promote');
        Route::get('events/{event}/registrations/export', [EventRegistrationController::class, 'export'])->name('events.registrations.export');

        Route::resource('payment-methods', ManualPaymentMethodController::class)->except(['show']);

        Route::get('moderation', [ModerationController::class, 'index'])->name('moderation.index');
        Route::post('moderation/records/{record}', [ModerationController::class, 'moderateRecord'])->name('moderation.records');
        Route::post('moderation/videos/{video}', [ModerationController::class, 'moderateVideo'])->name('moderation.videos');

        Route::get('payment-proofs', [PaymentProofReviewController::class, 'index'])->name('payment-proofs.index');
        Route::post('payment-proofs/{proof}/confirm', [PaymentProofReviewController::class, 'confirm'])->name('payment-proofs.confirm');
        Route::post('payment-proofs/{proof}/reject', [PaymentProofReviewController::class, 'reject'])->name('payment-proofs.reject');

        Route::get('audit-logs', [AuditLogController::class, 'index'])->name('audit-logs.index');

        Route::get('settings', [SettingController::class, 'index'])->name('settings.index');
    });
