<?php

use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;

return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        commands: __DIR__.'/../routes/console.php',
        health: '/up',
    )
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->web(append: [
            \App\Http\Middleware\HotelContext::class,
            \App\Http\Middleware\ApplyTheme::class,
            \App\Http\Middleware\InjectThemeVariables::class,
        ]);

        $middleware->alias([
            'permission' => \App\Http\Middleware\CheckPermission::class,
            'super.admin' => \App\Http\Middleware\SuperAdminMiddleware::class,
            'package.access' => \App\Http\Middleware\CheckPackageAccess::class,
            'subscription' => \App\Http\Middleware\CheckSubscription::class,
            'check.module' => \App\Http\Middleware\CheckModuleAccess::class,
            'check.module.access' => \App\Http\Middleware\CheckModuleAccess::class,
            'verify.module.access' => \App\Http\Middleware\VerifyModuleAccess::class,
        ]);
    })
    ->withExceptions(function (Exceptions $exceptions) {
        //
    })->create();