<?php

use App\Domains\Admin\Controllers\AdminDashboardController;
use App\Domains\Admin\Controllers\TenantEditPageController;
use App\Domains\Admin\Controllers\TenantListPageController;
use App\Domains\Admin\Controllers\TenantPageController;
use App\Domains\Admin\Controllers\UserListPageController;
use App\Middleware\AdminRoleMiddleware;
use App\Middleware\IdentifyTenant;
use App\Middleware\LvOnlyMiddleware;
use Illuminate\Support\Facades\Route;

Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->group(function () {
    Route::prefix('admin')->group(function () {
        Route::get('/', AdminDashboardController::class);
        Route::get('/tenant', TenantPageController::class);
        Route::get('/users', UserListPageController::class);

        Route::middleware(LvOnlyMiddleware::class)->group(function () {
            Route::get('/tenants', TenantListPageController::class);
            Route::get('/tenants/{slug}', TenantEditPageController::class);
        });
    });
});
