<?php

use App\Http\Controllers\PagesController;
use App\Http\Controllers\RoleController;
use App\Http\Controllers\GenModelController;
use Illuminate\Support\Facades\Route;
use App\Models\ConfServerLicense;

use App\Http\Controllers\HomeController;
use App\Http\Controllers\Configuration\UserController;
use App\Http\Controllers\Configuration\GroupController;
use App\Http\Controllers\Configuration\CompanyController;
use App\Http\Controllers\Configuration\CompanyTypeController;
use App\Http\Controllers\Configuration\CompanyProfileController;
use App\Http\Controllers\Configuration\MenuController;
use App\Http\Controllers\Configuration\ConfigOptionController;
use App\Http\Controllers\Configuration\ExchangeRateController;
use App\Http\Controllers\Configuration\ConsigneeController;
use App\Http\Controllers\DeletePatchController;
use App\Http\Controllers\DischargePortController;
use App\Http\Controllers\ParameterController;
use App\Http\Controllers\PatchController;
use App\Http\Controllers\SendPatchController;
use App\Http\Controllers\ServerLicenseController;
use App\Http\Livewire\Pages\Role\RoleIndex;
use App\Http\Livewire\Pages\SendPatch\SendPatch;
/*
|--------------------------------------------------------------------------
| 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!
|
*/
// $test = ConfServerLicense::limit(3)->get();
// dd($test);


Route::middleware('guest')->group(function () {
    Route::get('/login', [\App\Http\Controllers\AuthController::class, 'loginView'])->name('loginView');
    Route::post('/login', [\App\Http\Controllers\AuthController::class, 'login'])->name('login');
    Route::get('/register', [\App\Http\Controllers\AuthController::class, 'registerView'])->name('registerView');
    Route::post('/register', [\App\Http\Controllers\AuthController::class, 'register'])->name('register');
});

Route::middleware('auth')->group(function () {
    Route::post('/logout', [\App\Http\Controllers\AuthController::class, 'logout'])->name('logout');

    Route::get('/', [HomeController::class, 'index'])->name('index');
    Route::get('/get-serverlicense',  [ServerLicenseController::class, 'getAllServerKey']);

    Route::get('/patch',  [PatchController::class, 'index']);
    Route::get('/send-patch',  [SendPatchController::class, 'index']);
    Route::get('/send-multi-patch',  [SendPatchController::class, 'indexMulti']);
    Route::get('/delete-multi-patch',  [DeletePatchController::class, 'indexMulti']);
    
    Route::get('/exchange-rate',  [ExchangeRateController::class, 'index']);
    Route::get('/parameter',  [ParameterController::class, 'index']);
    Route::get('/discharge-port',  [DischargePortController::class, 'index']);

    // Route::get('role', [RoleController::class ,'index'])->name('role-index');
    // Route::get('/role', [RoleIndex::class])->name('role-index');
    // Route::get('/generateModels', [GenModelController::class, 'generateModels']);
   
    Route::group(['prefix' => 'configurations'], function () {
        Route::resource('/user', UserController::class)->names([
            'index' => 'configurations.user.index',
            'store' => 'configurations.user.store',
            'edit' => 'configurations.user.edit',
            'update' => 'configurations.user.update',
            'destroy' => 'configurations.user.destroy',
        ]);
        Route::resource('/group', GroupController::class)->names([
            'index' => 'configurations.group.index',
            'store' => 'configurations.group.store',
            'edit' => 'configurations.group.edit',
            'update' => 'configurations.group.update',
            'destroy' => 'configurations.group.destroy',
        ]);
        Route::resource('/company', CompanyController::class)->names([
            'index' => 'configurations.company.index',
            'store' => 'configurations.company.store',
            'edit' => 'configurations.company.edit',
            'update' => 'configurations.company.update',
            'destroy' => 'configurations.company.destroy',
        ]);
        Route::resource('/company-type', CompanyTypeController::class)->names([
            'index' => 'configurations.company-type.index',
            'store' => 'configurations.company-type.store',
            'edit' => 'configurations.company-type.edit',
            'update' => 'configurations.company-type.update',
            'destroy' => 'configurations.company-type.destroy',
        ]);
        Route::resource('/menu', MenuController::class)->names([
            'index' => 'configurations.menu.index',
            'store' => 'configurations.menu.store',
            'edit' => 'configurations.menu.edit',
            'update' => 'configurations.menu.update',
            'destroy' => 'configurations.menu.destroy',
        ]);
        Route::resource('/consignee', ConsigneeController::class)->names([
            'index' => 'configurations.consignee.index',
            'store' => 'configurations.consignee.store',
            'edit' => 'configurations.consignee.edit',
            'update' => 'configurations.consignee.update',
            'destroy' => 'configurations.consignee.destroy',
        ]);
        Route::resource('/company-profile', CompanyProfileController::class)->names([
            'index' => 'configurations.company-profile.index',
            'store' => 'configurations.company-profile.store',
            'edit' => 'configurations.company-profile.edit',
            'update' => 'configurations.company-profile.update',
            'destroy' => 'configurations.company-profile.destroy',
        ]);

        // Route::get('/exchange-rate', [ExchangeRateController::class, 'mainlistExchangeRate'])->name('configurations.exchangerate');
        // /*  MENU :: Currency Code */
        // Route::get('/currency-code', [ExchangeRateController::class, 'mainlistCurrency'])->name('configurations.currency');
        // /*  MENU :: Config Option  */
        // Route::get('/config-option', [ConfigOptionController::class, 'mainlist'])->name('configurations.configoption');
        // /*  MENU :: Currency Code */
        // Route::get('/currency-code', [ExchangeRateController::class, 'mainlistCurrency'])->name('configurations.currency');
   
        
       
   
    });
    Route::get('send-patch' ,SendPatch::class)->name('send-patch');
});
















