<?php

use App\Http\Controllers\Testing\TestCheckoutController;
use App\Http\Controllers\Testing\TestCouponController;
use App\Http\Controllers\Testing\TestEventController;
use App\Http\Controllers\Testing\TestGuestEventController;
use App\Http\Controllers\Testing\TestMailboxController;
use App\Http\Middleware\EnsureE2ETestingAccess;
use Illuminate\Support\Facades\Route;

Route::prefix('_testing')->middleware(EnsureE2ETestingAccess::class)->group(function () {
    Route::get('/mailbox', [TestMailboxController::class, 'index'])->name('testing.mailbox.index');
    Route::delete('/mailbox', [TestMailboxController::class, 'destroy'])->name('testing.mailbox.destroy');

    Route::post('/coupons/seed', [TestCouponController::class, 'store'])->name('testing.coupons.seed');

    Route::get('/checkout/sessions/latest', [TestCheckoutController::class, 'latest'])->name('testing.checkout.sessions.latest');
    Route::post('/checkout/sessions/{session}/simulate-paddle', [TestCheckoutController::class, 'simulatePaddle'])
        ->whereUuid('session')
        ->name('testing.checkout.sessions.simulate-paddle');

    Route::get('/events/join-token', [TestEventController::class, 'joinToken'])->name('testing.events.join-token');
    Route::post('/guest-events', [TestGuestEventController::class, 'store'])->name('testing.guest-events.store');
});
