<?php
/**
 *
 * @version     1.0.$Revision:$
 * @version     SVN: $Id:$
 * @package     bplan-base/globals
 * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 * @copyright   Copyright (C) 2025 Wassilios Meletiadis <https://www.bplan-solutions.de/>
 * /Δ\
 */


use BplanBase\Globals\Http\Controllers\CountryController;
use BplanBase\Globals\Http\Controllers\DemoController;
use BplanBase\Globals\Http\Controllers\IndividualController;
use BplanBase\Globals\Http\Controllers\LocaleController;
use BplanBase\Globals\Http\Controllers\LocationController;
use BplanBase\Globals\Http\Controllers\PrinterController;
use BplanBase\Globals\Http\Controllers\PrinterTypeController;
use BplanBase\Globals\Http\Controllers\PrintJobController;
use BplanBase\Globals\Http\Controllers\TenantController;
use BplanBase\Globals\Http\Controllers\UserController;
use Illuminate\Support\Facades\Route;


/**
 * Admin role needed
 */
Route::middleware([
    'web',
    'auth:sanctum',
    'verified',
    'access-level.or.roles:SystemManager,Admin',

])->group(function () {
    Route::get('/countries',     [CountryController::class,     'index'])->name('countries.index');
    Route::get('/individuals',   [IndividualController::class,  'index'])->name('individuals.index');
    Route::get('/locations',     [LocationController::class,    'index'])->name('locations.index');
    Route::get('/print-jobs',    [PrintJobController::class,    'index'])->name('print-jobs.index');
    Route::get('/printers',      [PrinterController::class,     'index'])->name('printers.index');
    Route::get('/printer-types', [PrinterTypeController::class, 'index'])->name('printer-types.index');
    Route::get('/tenants',       [TenantController::class,      'index'])->name('tenants.index');
    Route::get('/users',         [UserController::class,        'index'])->name('users.index');
});


if (str_starts_with(strtolower(config('app.env')), 'demo') === true) {
    /**
     * AccessLevel "SystemManager" needed
     */
    Route::middleware([
        'web',

    ])->group(function () {
        Route::get('/demo-reset-page',   [DemoController::class, 'showResetPage']);
        Route::get('/demo-reset-stream', [DemoController::class, 'streamReset']);
    });
}

Route::middleware([
        'web',
        'auth:sanctum',
        'verified'
])->group(function () {
    Route::get('/profile', function () {
        return view('globals::containers.profile.show');

    })->name('profile.show');
});

Route::middleware(['web'])->group(function () {
    Route::get('/locale/{locale}', [LocaleController::class, 'setLocale'])->name('locale.set');
});

// require __DIR__.'/web/admin.php';
require __DIR__.'/web/core.php';
