<?php

use CodeIgniter\Router\RouteCollection;

/**
 * @var RouteCollection $routes
 */

//추가 Custom RULE 만들때 : ex)UUID형식
$routes->addPlaceholder('uuid', '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}');
//authFilter는 추가적인 작업이 필요
//1. app/Filters/AuthFilter.php
//2. Config/Filters.php -> $aliases = ['authFilter' => AuthFilter::class]
$routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) {});
$routes->group('', ['namespace' => 'App\Controllers'], function ($routes) {
    $routes->get('/', 'Home::index');
    $routes->group('auth', ['namespace' => 'App\Controllers\Auth'], function ($routes) {
        $routes->get('login', 'LocalController::create_form');
        $routes->post('login', 'LocalController::create');
        $routes->get('google_login', 'GoogleController::create');
        $routes->get('logout', 'LocalController::logout');
    });
});
$routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:manager'], function ($routes) {
    $routes->get('/', 'Home::index');
    $routes->group('user', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:master'], function ($routes) {
        $routes->get('/', 'UserController::index', []);
        $routes->get('create', 'UserController::create_form');
        $routes->post('create', 'UserController::create');
        $routes->get('modify/(:num)', 'UserController::modify_form/$1');
        $routes->post('modify/(:num)', 'UserController::modify/$1');
        $routes->get('view/(:num)', 'UserController::view/$1');
        $routes->get('delete/(:num)', 'UserController::delete/$1');
        $routes->get('toggle/(:num)/(:any)', 'UserController::toggle/$1/$2');
        $routes->post('batchjob', 'UserController::batchjob');
        $routes->post('batchjob_delete', 'UserController::batchjob_delete');
        $routes->get('download/(:alpha)', 'UserController::download/$1');
    });
    $routes->group('mylog', ['namespace' => 'App\Controllers\Admin'], function ($routes) {
        $routes->get('/', 'MyLogController::index');
        $routes->get('view/(:num)', 'MyLogController::view/$1');
    });
    $routes->group('customer', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
        $routes->group('client', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
            $routes->get('/', 'ClientController::index', []);
            $routes->get('create', 'ClientController::create_form');
            $routes->post('create', 'ClientController::create');
            $routes->get('modify/(:num)', 'ClientController::modify_form/$1');
            $routes->post('modify/(:num)', 'ClientController::modify/$1');
            $routes->get('view/(:num)', 'ClientController::view/$1');
            $routes->get('delete/(:num)', 'ClientController::delete/$1');
            $routes->get('toggle/(:num)/(:any)', 'ClientController::toggle/$1/$2');
            $routes->post('batchjob', 'ClientController::batchjob');
            $routes->post('batchjob_delete', 'ClientController::batchjob_delete');
            $routes->get('download/(:alpha)', 'ClientController::download/$1');
        });
        $routes->group('account', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
            $routes->get('/', 'AccountController::index', []);
            $routes->get('create', 'AccountController::create_form');
            $routes->post('create', 'AccountController::create');
            $routes->get('modify/(:num)', 'AccountController::modify_form/$1');
            $routes->post('modify/(:num)', 'AccountController::modify/$1');
            $routes->get('view/(:num)', 'AccountController::view/$1');
            $routes->get('delete/(:num)', 'AccountController::delete/$1');
            $routes->get('toggle/(:num)/(:any)', 'AccountController::toggle/$1/$2');
            $routes->post('batchjob', 'AccountController::batchjob');
            $routes->post('batchjob_delete', 'AccountController::batchjob_delete');
            $routes->get('download/(:alpha)', 'AccountController::download/$1');
        });
        $routes->group('coupon', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
            $routes->get('/', 'CouponController::index', []);
            $routes->get('create', 'CouponController::create_form');
            $routes->post('create', 'CouponController::create');
            $routes->get('modify/(:num)', 'CouponController::modify_form/$1');
            $routes->post('modify/(:num)', 'CouponController::modify/$1');
            $routes->get('view/(:num)', 'CouponController::view/$1');
            $routes->get('delete/(:num)', 'CouponController::delete/$1');
            $routes->get('toggle/(:num)/(:any)', 'CouponController::toggle/$1/$2');
            $routes->post('batchjob', 'CouponController::batchjob');
            $routes->post('batchjob_delete', 'CouponController::batchjob_delete');
            $routes->get('download/(:alpha)', 'CouponController::download/$1');
        });
        $routes->group('point', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
            $routes->get('/', 'PointController::index', []);
            $routes->get('create', 'PointController::create_form');
            $routes->post('create', 'PointController::create');
            $routes->get('modify/(:num)', 'PointController::modify_form/$1');
            $routes->post('modify/(:num)', 'PointController::modify/$1');
            $routes->get('view/(:num)', 'PointController::view/$1');
            $routes->get('delete/(:num)', 'PointController::delete/$1');
            $routes->get('toggle/(:num)/(:any)', 'PointController::toggle/$1/$2');
            $routes->post('batchjob', 'PointController::batchjob');
            $routes->post('batchjob_delete', 'PointController::batchjob_delete');
            $routes->get('download/(:alpha)', 'PointController::download/$1');
        });
        $routes->group('service', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
            $routes->get('/', 'ServiceController::index', []);
            $routes->get('create', 'ServiceController::create_form');
            $routes->post('create', 'ServiceController::create');
            $routes->get('modify/(:num)', 'ServiceController::modify_form/$1');
            $routes->post('modify/(:num)', 'ServiceController::modify/$1');
            $routes->get('view/(:num)', 'ServiceController::view/$1');
            $routes->get('delete/(:num)', 'ServiceController::delete/$1');
            $routes->get('toggle/(:num)/(:any)', 'ServiceController::toggle/$1/$2');
            $routes->post('batchjob', 'ServiceController::batchjob');
            $routes->post('batchjob_delete', 'ServiceController::batchjob_delete');
            $routes->get('download/(:alpha)', 'ServiceController::download/$1');
        });
        $routes->group('serviceitem', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
            $routes->get('/', 'ServiceItemController::index', []);
            $routes->get('create', 'ServiceItemController::create_form');
            $routes->post('create', 'ServiceItemController::create');
            $routes->get('modify/(:num)', 'ServiceItemController::modify_form/$1');
            $routes->post('modify/(:num)', 'ServiceItemController::modify/$1');
            $routes->get('view/(:num)', 'ServiceItemController::view/$1');
            $routes->get('delete/(:num)', 'ServiceItemController::delete/$1');
            $routes->get('toggle/(:num)/(:any)', 'ServiceItemController::toggle/$1/$2');
            $routes->post('batchjob', 'ServiceItemController::batchjob');
            $routes->post('batchjob_delete', 'ServiceItemController::batchjob_delete');
            $routes->get('download/(:alpha)', 'ServiceItemController::download/$1');
        });
    });
    $routes->group('equipment', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
        $routes->group('server', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
            $routes->get('/', 'ServerController::index', []);
            $routes->get('create', 'ServerController::create_form');
            $routes->post('create', 'ServerController::create');
            $routes->get('modify/(:num)', 'ServerController::modify_form/$1');
            $routes->post('modify/(:num)', 'ServerController::modify/$1');
            $routes->get('view/(:num)', 'ServerController::view/$1');
            $routes->get('delete/(:num)', 'ServerController::delete/$1');
            $routes->get('toggle/(:num)/(:any)', 'ServerController::toggle/$1/$2');
            $routes->post('batchjob', 'ServerController::batchjob');
            $routes->post('batchjob_delete', 'ServerController::batchjob_delete');
            $routes->get('download/(:alpha)', 'ServerController::download/$1');
        });
        $routes->group('domain', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
            $routes->get('/', 'DomainController::index', []);
            $routes->get('create', 'DomainController::create_form');
            $routes->post('create', 'DomainController::create');
            $routes->get('modify/(:num)', 'DomainController::modify_form/$1');
            $routes->post('modify/(:num)', 'DomainController::modify/$1');
            $routes->get('view/(:num)', 'DomainController::view/$1');
            $routes->get('delete/(:num)', 'DomainController::delete/$1');
            $routes->get('toggle/(:num)/(:any)', 'DomainController::toggle/$1/$2');
            $routes->post('batchjob', 'DomainController::batchjob');
            $routes->post('batchjob_delete', 'DomainController::batchjob_delete');
            $routes->get('download/(:alpha)', 'DomainController::download/$1');
        });
        $routes->group('part', ['namespace' => 'App\Controllers\Admin\Equipment\Part'], function ($routes) {
            $routes->group('line', ['namespace' => 'App\Controllers\Admin\Equipment\Part'], function ($routes) {
                $routes->get('/', 'LineController::index', []);
                $routes->get('create', 'LineController::create_form');
                $routes->post('create', 'LineController::create');
                $routes->get('modify/(:num)', 'LineController::modify_form/$1');
                $routes->post('modify/(:num)', 'LineController::modify/$1');
                $routes->get('view/(:num)', 'LineController::view/$1');
                $routes->get('delete/(:num)', 'LineController::delete/$1');
                $routes->get('toggle/(:num)/(:any)', 'LineController::toggle/$1/$2');
                $routes->post('batchjob', 'LineController::batchjob');
                $routes->post('batchjob_delete', 'LineController::batchjob_delete');
                $routes->get('download/(:alpha)', 'LineController::download/$1');
            });
            $routes->group('ip', ['namespace' => 'App\Controllers\Admin\Equipment\Part'], function ($routes) {
                $routes->get('/', 'IpController::index', []);
                $routes->get('create', 'IpController::create_form');
                $routes->post('create', 'IpController::create');
                $routes->get('modify/(:num)', 'IpController::modify_form/$1');
                $routes->post('modify/(:num)', 'IpController::modify/$1');
                $routes->get('view/(:num)', 'IpController::view/$1');
                $routes->get('delete/(:num)', 'IpController::delete/$1');
                $routes->get('toggle/(:num)/(:any)', 'IpController::toggle/$1/$2');
                $routes->post('batchjob', 'IpController::batchjob');
                $routes->post('batchjob_delete', 'IpController::batchjob_delete');
                $routes->get('download/(:alpha)', 'IpController::download/$1');
            });
            $routes->group('defence', ['namespace' => 'App\Controllers\Admin\Equipment\Part'], function ($routes) {
                $routes->get('/', 'DefenceController::index', []);
                $routes->get('create', 'DefenceController::create_form');
                $routes->post('create', 'DefenceController::create');
                $routes->get('modify/(:num)', 'DefenceController::modify_form/$1');
                $routes->post('modify/(:num)', 'DefenceController::modify/$1');
                $routes->get('view/(:num)', 'DefenceController::view/$1');
                $routes->get('delete/(:num)', 'DefenceController::delete/$1');
                $routes->get('toggle/(:num)/(:any)', 'DefenceController::toggle/$1/$2');
                $routes->post('batchjob', 'DefenceController::batchjob');
                $routes->post('batchjob_delete', 'DefenceController::batchjob_delete');
                $routes->get('download/(:alpha)', 'DefenceController::download/$1');
            });
            $routes->group('software', ['namespace' => 'App\Controllers\Admin\Equipment\Part'], function ($routes) {
                $routes->get('/', 'SoftwareController::index', []);
                $routes->get('create', 'SoftwareController::create_form');
                $routes->post('create', 'SoftwareController::create');
                $routes->get('modify/(:num)', 'SoftwareController::modify_form/$1');
                $routes->post('modify/(:num)', 'SoftwareController::modify/$1');
                $routes->get('view/(:num)', 'SoftwareController::view/$1');
                $routes->get('delete/(:num)', 'SoftwareController::delete/$1');
                $routes->get('toggle/(:num)/(:any)', 'SoftwareController::toggle/$1/$2');
                $routes->post('batchjob', 'SoftwareController::batchjob');
                $routes->post('batchjob_delete', 'SoftwareController::batchjob_delete');
                $routes->get('download/(:alpha)', 'SoftwareController::download/$1');
            });
            $routes->group('cpu', ['namespace' => 'App\Controllers\Admin\Equipment\Part'], function ($routes) {
                $routes->get('/', 'CpuController::index', []);
                $routes->get('create', 'CpuController::create_form');
                $routes->post('create', 'CpuController::create');
                $routes->get('modify/(:num)', 'CpuController::modify_form/$1');
                $routes->post('modify/(:num)', 'CpuController::modify/$1');
                $routes->get('view/(:num)', 'CpuController::view/$1');
                $routes->get('delete/(:num)', 'CpuController::delete/$1');
                $routes->get('toggle/(:num)/(:any)', 'CpuController::toggle/$1/$2');
            });
            $routes->group('ram', ['namespace' => 'App\Controllers\Admin\Equipment\Part'], function ($routes) {
                $routes->get('/', 'RamController::index', []);
                $routes->get('create', 'RamController::create_form');
                $routes->post('create', 'RamController::create');
                $routes->get('modify/(:num)', 'RamController::modify_form/$1');
                $routes->post('modify/(:num)', 'RamController::modify/$1');
                $routes->get('view/(:num)', 'RamController::view/$1');
                $routes->get('delete/(:num)', 'RamController::delete/$1');
                $routes->get('toggle/(:num)/(:any)', 'RamController::toggle/$1/$2');
            });
            $routes->group('storage', ['namespace' => 'App\Controllers\Admin\Equipment\Part'], function ($routes) {
                $routes->get('/', 'StorageController::index', []);
                $routes->get('create', 'StorageController::create_form');
                $routes->post('create', 'StorageController::create');
                $routes->get('modify/(:num)', 'StorageController::modify_form/$1');
                $routes->post('modify/(:num)', 'StorageController::modify/$1');
                $routes->get('view/(:num)', 'StorageController::view/$1');
                $routes->get('delete/(:num)', 'StorageController::delete/$1');
                $routes->get('toggle/(:num)/(:any)', 'StorageController::toggle/$1/$2');
            });
        });
    });
});
