<?php


use Illuminate\Support\Facades\Route;
use Mehrab\User\Http\Controllers\Auth\AuthController;
use Mehrab\User\Http\Controllers\UserController;

//manage users
Route::group(
    get_information_for_admin_panel_route_group()

    , function () {
    Route::put('users/status/{user}', [UserController::class, 'status'])->name('users.status');
    Route::put('users/status_available', [UserController::class, 'status_available'])->name('users.status_available');
    Route::get('users/roles/{user}', [UserController::class, 'edit_roles'])->name('users.edit_roles');
    Route::delete('users/delete/{user}', [UserController::class, 'delete_user'])->name('users.delete');
    Route::patch('users/roles/{user}', [UserController::class, 'update_roles'])->name('users.update_roles');
    Route::get('update_profile_info', [UserController::class, 'update_profile_info'])->name('users.update_profile_info');
    Route::post('update_profile', [UserController::class, 'update_profile'])->name('users.update_profile');
    Route::post('update_password', [UserController::class, 'update_password'])->name('users.update_password');
    Route::resource('users', UserController::class);
}
);

//Auth route
Route::group([
        'prefix' => 'authenticate',
        'middleware' => ['web']
    ]
    , function () {
        Route::get('/', [AuthController::class, 'index'])->name('auth.index');
        Route::post('/check_exists_and_status', [AuthController::class, 'check_exists_and_status'])->name('auth.check_exists_and_status');

        Route::post('/register', [AuthController::class, 'register'])->name('auth.register');
        Route::post('/send_login_code', [AuthController::class, 'send_login_code'])->name('auth.send_login_code');
        Route::post('/check_code', [AuthController::class, 'check_code'])->name('auth.check_code');

        Route::post('/login_user', [AuthController::class, 'login_user'])->name('auth.login');

        Route::post('/logout_user', [AuthController::class, 'logout'])->name('auth.logout')->middleware('auth');

//        Route::get('/forgot_password_view', [AuthController::class, 'forgot_password_view'])->name('auth.forgot_password_view');
        Route::post('/forgot_password_send', [AuthController::class, 'forgot_password_send'])->name('auth.forgot_password_send');
        Route::post('/forgot_password_check_code', [AuthController::class, 'forgot_password_check_code'])->name('auth.forgot_password_check_code');
    });
