<?php

/**
 * Users module routes. Permission-gated per action (see PermissionSeeder
 * for the users.* permission catalog).
 * @var \CodeIgniter\Router\RouteCollection $routes
 */
$routes->group('users', ['filter' => 'auth'], static function ($routes) {
    $routes->get('/', '\Modules\Users\Controllers\UserController::index', ['filter' => 'permission:users.view']);
    $routes->get('create', '\Modules\Users\Controllers\UserController::createForm', ['filter' => 'permission:users.create']);
    $routes->post('/', '\Modules\Users\Controllers\UserController::store', ['filter' => 'permission:users.create']);
    $routes->get('(:num)/edit', '\Modules\Users\Controllers\UserController::editForm/$1', ['filter' => 'permission:users.edit']);
    $routes->post('(:num)', '\Modules\Users\Controllers\UserController::update/$1', ['filter' => 'permission:users.edit']);
    $routes->get('(:num)', '\Modules\Users\Controllers\UserController::show/$1', ['filter' => 'permission:users.view']);
    $routes->post('(:num)/avatar', '\Modules\Users\Controllers\UserController::uploadAvatar/$1', ['filter' => 'permission:users.edit']);
    $routes->post('(:num)/activate', '\Modules\Users\Controllers\UserController::activate/$1', ['filter' => 'permission:users.edit']);
    $routes->post('(:num)/deactivate', '\Modules\Users\Controllers\UserController::deactivate/$1', ['filter' => 'permission:users.edit']);
    $routes->post('(:num)/delete', '\Modules\Users\Controllers\UserController::destroy/$1', ['filter' => 'permission:users.delete']);
    $routes->post('(:num)/restore', '\Modules\Users\Controllers\UserController::restore/$1', ['filter' => 'permission:users.delete']);
    $routes->post('(:num)/reset-password', '\Modules\Users\Controllers\UserController::resetPassword/$1', ['filter' => 'permission:users.edit']);
});
