<?php

use App\Http\Controllers\Api\V1\HomeController;
use App\Http\Controllers\Auth\LoginController;
use App\Http\Controllers\AuthController;
use App\Http\Controllers\SM\AppController;
use App\Http\Controllers\SM\FunctionController;
use App\Http\Controllers\SM\PermissionController;
use App\Http\Controllers\SM\RoleController;
use App\Http\Controllers\SM\SecurityController;
use App\Http\Controllers\SM\UserController;
use App\Http\Controllers\WS\AboutUsController;
use App\Http\Controllers\WS\ContactUsController;
use App\Http\Controllers\WS\GalleryController;
use App\Http\Controllers\WS\MenuController;
use App\Http\Controllers\WS\ServiceController;
use App\Http\Controllers\WS\SlideController;
use App\Http\Controllers\WS\VisionController;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;

Route::post('login', [LoginController::class, 'login']);
Route::group(['prefix' => 'api/auth/'], function () {
    Route::post('/user', [AuthController::class, 'user']);
});
Route::group(['middleware' => 'auth:sanctum'], function () {
    Route::group(['prefix' => '/api/security-management'], function () {
        Route::resource('/users', UserController::class);
        Route::post('/users/remove', [UserController::class, 'remove']);
        Route::resource('/permissions', PermissionController::class);
        Route::resource('/applications', AppController::class);
        Route::resource('/roles', RoleController::class);
        Route::resource('/functions', FunctionController::class);
        Route::get('/selections', [SecurityController::class, 'index']);
        Route::get('/selections/user-module', [SecurityController::class, 'userModule']);
        Route::get('/selections/function-module', [SecurityController::class, 'fncModule']);
        Route::get('/selections/role-module', [SecurityController::class, 'roleModule']);
    });

    Route::group(['prefix' => '/api/website'], function () {
        Route::resource('/about-us', AboutUsController::class);
        Route::get('/about-us-total', [AboutUsController::class, 'total']);
        Route::resource('/visions', VisionController::class);
        Route::delete('/visions-delete', [VisionController::class, 'delete']);

        Route::resource('/services', ServiceController::class);
        Route::delete('/services-delete', [ServiceController::class, 'delete']);

        Route::resource('/menu', MenuController::class);
        Route::delete('/menu-delete', [MenuController::class, 'delete']);

        Route::resource('/slides', SlideController::class);
        Route::delete('/slide-delete', [SlideController::class, 'delete']);

        Route::resource('galleries', GalleryController::class);

        Route::resource('contact-us', ContactUsController::class);
        Route::get('/contact-us-total', [ContactUsController::class, 'total']);
    });
});
Route::prefix('api/v1')->group(function () {
    Route::get('/home', [HomeController::class, 'index']);
});
Route::get('{any}', function () {
    return view('app');
})->where('any', '.*');
