<?php

use App\Http\Controllers\Hr\Employees\CompanyEmployeesController;
use App\Http\Controllers\User\UserPermissionsController;
use App\Http\Controllers\User\UserRolesController;
use App\Http\Controllers\UserController;
use Illuminate\Support\Facades\Route;

Route::get('/user-roles', [UserRolesController::class, 'index']);

Route::get('/add-user-role', [UserRolesController::class, 'showAddNewRole']);
Route::post('/add-user-role', [UserRolesController::class, 'storeAddNewRole']);

Route::get('/user-permissions', [UserPermissionsController::class, 'index']);

Route::get('/add-user-permission', [UserPermissionsController::class, 'showAddNewPermission']);
Route::post('/add-user-permission', [UserPermissionsController::class, 'storeAddNewPermission']);

Route::get('/assign-permissions-to-role/{id}', [UserRolesController::class, 'showAssignPermissionsToRole'])->middleware('settings-header');
Route::post('/assign-permissions-to-role/{id}', [UserRolesController::class, 'storeAssignPermissionsToRole'])->middleware('settings-header');

Route::get('/view-assigned-permissions-to-role/{id}', [UserRolesController::class, 'showViewAssignedPermissionsToRole'])->middleware('settings-header');

Route::put('/revoke-permission/{id}/{permission}', [UserRolesController::class, 'revokePermission'])->middleware('settings-header');


Route::get('/manage-user-roles-and-permissions', [UserController::class, 'viewUserRolesAndPermissions'])->middleware('settings-header');

Route::get('/assign-roles-to-user/{id}', [UserRolesController::class, 'showAssignRolesToUser'])->middleware('settings-header');
Route::post('/assign-roles-to-user/{id}', [UserRolesController::class, 'storeAssignRolesToUser'])->middleware('settings-header');

Route::get('/assign-permissions-to-user/{id}', [UserRolesController::class, 'showAssignPermissionsToUser'])->middleware('settings-header');
Route::post('/assign-permissions-to-user/{id}', [UserRolesController::class, 'storeAssignPermissionsToUser'])->middleware('settings-header');

Route::get('/view-assigned-roles-to-a-user/{id}', [UserRolesController::class, 'showViewAssignedRolesToAUser'])->middleware('settings-header');
Route::put('/revoke-role-for-a-user/{id}/{role}', [UserRolesController::class, 'revokeUserRole'])->middleware('settings-header');

Route::get('/view-assigned-permissions-via-roles-to-a-user/{id}', [UserRolesController::class, 'showViewAssignedPermissionsViaRolesToAUser'])->middleware('settings-header');

Route::get('/view-assigned-direct-permissions-to-a-user/{id}', [UserRolesController::class, 'showViewAssignedDirectPermissionsToAUser'])->middleware('settings-header');
Route::put('/revoke-direct-permission-for-a-user/{id}/{permission}', [UserRolesController::class, 'revokeUserDirectPermission'])->middleware('settings-header');

/**Manage User Notifications**/
Route::get('/get-my-notifications', [\App\Http\Controllers\UserNotificationController::class, 'showUserNotifications']);
Route::get('/view-my-notifications', [\App\Http\Controllers\UserNotificationController::class, 'viewMyNotifications']);

Route::get('/upload-employee-files/{id}', [CompanyEmployeesController::class, 'showUploadEmployeeFiles']);
Route::post('/upload-employee-files/{id}', [CompanyEmployeesController::class, 'storeUploadEmployeeFiles'])->name('storeUploadEmployeeFiles.store');
