<?php

use Illuminate\Support\Facades\Route;


use App\Http\Controllers\StatusCategoryController;
use App\Http\Controllers\SubCategoryController;
use App\Http\Controllers\ScheduledMaintenanceController;
use App\Http\Controllers\IncidentController;
use App\Http\Controllers\IncidentMessageController;
use App\Http\Controllers\DomainSaleController;
use App\Http\Controllers\FinancingController;
use App\Http\Controllers\BlogController;
use App\Http\Controllers\TransferController;

// Admin Routes
use App\Http\Controllers\Admin\AnnounceController;
use App\Http\Controllers\Admin\AdminAuthenticateController;
use App\Http\Controllers\Admin\ManageUsersController;
use App\Http\Controllers\Admin\AdminController as AdminManagementController;
use App\Http\Controllers\Admin\ProfileController as AdminProfileController;




Route::group(['middleware' => 'RouteFilter'] ,function(){
    Route::controller(AdminAuthenticateController::class)->group(function(){
        Route::get('/aict.py', 'aict')->name('aict');
        Route::post('/aict_login', 'login')->name('aict_login');
        Route::get('/aict_login', 'login')->name('aict_login');
        Route::get('/aict_logout', 'logout')->name('aict_logout');
    });
});




Route::middleware('Admin')->prefix('admin')->group(function(){
    Route::resources([
        '/announces' => AnnounceController::class,
        '/admin-account' => AdminManagementController::class,
        '/blog' => BlogController::class,
        '/DomainSale' => DomainSaleController::class,
        '/Financing' => FinancingController::class,
        '/StatusCategory' => StatusCategoryController::class,
        '/SubCategory' => SubCategoryController::class,
        '/ScheduledMain' => ScheduledMaintenanceController::class,
        '/Incident' => IncidentController::class,
       
    ]);
       

    Route::get('/Schedule/Message/{id}/delete' , [ScheduledMaintenanceController::class , 'DeleteMessage'])->name('ScheduleMessage.delete');
    Route::get('/history/{id}' , [IncidentMessageController::class , 'History_Delete']);

    Route::controller(ManageUsersController::class)->group(function(){
        Route::get('/manage-users', 'index')->name('manage-users.index');
        Route::get('/manage-users/suspend/{user}', 'suspendUser')->name('manage-users.suspend');
        Route::get('/manage-users/change-sms-status/{user}', 'changeSMSStatus')->name('manage-users.change.sms.status');
        Route::get('/manage-users/users/change-password/{user}', 'changePasswordView')->name('manage-users.change.password.view');
        Route::post('/manage-users/users/change-password/{user}', 'storePassword')->name('manage-users.change.password.store');
        Route::get('/manage-users/users/disable-google2fa/{user}', 'change_google2fa')->name('manage-users.disable.google2fa');
        Route::get('/manage-users/users/{user}/delete', 'deleteUser')->name('manage-users.delete');
    });


    Route::controller(TransferController::class)->group(function(){
        Route::get('/domain-transfer', 'DomainTransferView')->name('domain.transfer.index');
        Route::get('/domain-transfer/{id}/update-status', 'DomainTransferChange')->name('domain.transfer.update');
        Route::get('/domain-transfer/{id}/delete', 'DeleteDomainTransfer')->name('domain.transfer.delete');
        Route::get('/leap-domain-transfer', 'LeapDomainTransfer')->name('leap.domain.transfer.index');
        Route::get('/leap-domain-transfer/{id}/update-status', 'ChangeLeapDomainTransfer')->name('leap.domain.transfer.change.status');
        Route::get('/leap-domain-transfer/{id}/delete', 'DeleteLeapDomainTransfer')->name('leap.domain.transfer.delete');
    });

    Route::controller(AdminProfileController::class)->group(function(){
        Route::get('/', 'index');
        Route::get('/change-password', 'changePasswordView')->name('profile.change.password.page');
        Route::post('/save-password', 'savePassword')->name('profile.change.password.save');
    });


});