<?php

use App\Domains\Event\Controllers\ArchivedEventsController;
use App\Domains\Event\Controllers\AvailableEventsController;
use App\Domains\Event\Controllers\CreateController;
use App\Domains\Event\Controllers\DetailsController;
use App\Domains\Event\Controllers\SignupController;
use App\Middleware\IdentifyTenant;
use Illuminate\Support\Facades\Route;

Route::middleware(IdentifyTenant::class)->group(function () {
    Route::prefix('event')->group(function () {
        Route::get('/available-events', AvailableEventsController::class);


        Route::get('/{eventId}', SignupController::class);
        Route::get('/{eventId}/signup', SignupController::class);

        Route::middleware(['auth'])->group(function () {
            Route::get('/details/{eventId}', DetailsController::class);
            Route::get('/details/{eventId}/pdf/{listType}', [DetailsController::class, 'downloadPdfList']);
            Route::get('/details/{eventId}/csv/{listType}', [DetailsController::class, 'downloadCsvList']);
        });
    });

    Route::middleware(['auth'])->group(function () {
        Route::get('/create-event', CreateController::class);
        Route::get('/archived-events', ArchivedEventsController::class);
    });
});
