<?php

use App\Http\Controllers\Auth;
use App\Http\Controllers\InformaciaController;
use App\Http\Controllers\PlochaController;
use App\Http\Controllers\PouzivatelController;
use Illuminate\Support\Facades\Route;
use UniSharp\LaravelFilemanager\Lfm;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::prefix('/prihlasenie')
    ->middleware('guest')
    ->name('login.')
    ->group(function () {
        Route::get('/', [Auth\LoginController::class, 'showLoginForm'])->name('form');
        Route::post('/', [Auth\LoginController::class, 'login'])->name('login');
    });

Route::middleware('auth')
    ->group(function () {
        Route::post('/odhlasenie', [Auth\LoginController::class, 'logout'])->name('logout');
    });

Route::middleware('auth')
    ->name('portal.')
    ->group(function () {
        Route::get('/', [PlochaController::class, 'index'])->name('plocha');

        Route::prefix('pouzivatel')
            ->name('pouzivatel.')
            ->group(function () {
                Route::get('notifikacie', [PouzivatelController::class, 'index'])->name('notifikacie.index');
            });

        Route::prefix('informacie')
            ->name('informacie.')
            ->group(function () {
                Route::get('/', [InformaciaController::class, 'index'])->name('index');
                Route::get('/{informaciaId}', [InformaciaController::class, 'show'])->name('show');
            });
    });

Route::middleware('auth')
    ->group(function () {
        Route::prefix('file-manager')
            ->group(function () {
                Lfm::routes();
            });
    });
