<?php

use Illuminate\Support\Facades\Route;

use App\Http\Controllers\UserController;
use App\Http\Controllers\CreateUserController;
use App\Http\Controllers\LoginController;
use App\Http\Controllers\LogoutController;
use App\Livewire\Counter;



Route::middleware(['auth:sanctum'])->group(function () {
    //Rotas LinePBX.
});

Route::middleware(['auth'])->group(function () {

    Route::controller(UserController::class)->group(function () {
        Route::get('/dashboard', 'dashboard')->name('dashboard');
        Route::post('/create-users', 'createUsers')->name('users.create')->middleware('authorization');
    });

    Route::controller(LogoutController::class)->group(function () {
        Route::post('/logout', [LogoutController::class, 'logout'])->name('logout');
    });

    Route::get('/create-users', function () {
        return view('users.create-users');
    })->name('users.create')->middleware('authorization');
});

Route::controller(LoginController::class)->group(function () {
    Route::get('/login', function () {
        return view('login');
    })->name('login');
    Route::post('/login',  [LoginController::class, 'login'])->name('login-post');
});
