<?php

use App\Http\Controllers\SuperAdmin\AuthController;
use App\Http\Controllers\SuperAdmin\BranchController;
use App\Http\Controllers\SuperAdmin\ClientController;
use App\Http\Controllers\SuperAdmin\DashboardController;
use App\Http\Controllers\SuperAdmin\SettingsController;
use Illuminate\Support\Facades\Route;

Route::get('login', [AuthController::class, 'login'])->name('login');
Route::post('login', [AuthController::class, 'authenticate']);

Route::middleware(['auth', 'super-admin'])->group(function () {
    Route::get('dashboard', [DashboardController::class, 'index'])->name('super-admin.dashboard');
    Route::post('logout', [AuthController::class, 'logout'])->name('super-admin.logout');
    Route::resource('clients', ClientController::class);
    Route::resource('branches', BranchController::class);

    Route::get('settings', [SettingsController::class, 'edit'])->name('settings.edit');
    Route::patch('settings/profile', [SettingsController::class, 'updateProfile'])->name('settings.profile.update');
    Route::patch('settings/password', [SettingsController::class, 'updatePassword'])->name('settings.password.update');
    Route::post('settings/2fa', [SettingsController::class, 'enable2fa'])->name('settings.2fa.enable');
    Route::delete('settings/2fa', [SettingsController::class, 'disable2fa'])->name('settings.2fa.disable');
});
