<?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->get('/', 'Home::index');
$routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:manager'], function ($routes) {
    $routes->get('/', 'Home::index');
    $routes->group('user', function ($routes) {
        $routes->get('', 'UserController::index');
    });
});
$routes->group('mangboard', ['namespace' => 'App\Controllers\Mangboard'], function ($routes) {
    $routes->group('user', function ($routes) {
        $routes->get('/', 'UserController::index');
        $routes->cli('point/(:alpha)/(:num)', 'UserController::point/$1/$2');
        $routes->cli('point/(:alpha)/(:num)/(:any)', 'UserController::point/$1/$2/$3');
        $routes->cli('level/(:alpha)/(:num)', 'UserController::level/$1/$2');
        $routes->cli('check_level', 'UserController::check_level');
        $routes->cli('check_level/(:alpha)', 'UserController::check_level/$1');
    });
    $routes->group('crawler', function ($routes) {
        $routes->cli('yamap/(:any)', 'CrawlerController::yamap/$1');
        $routes->cli('yamap/(:any)/(:any)', 'CrawlerController::yamap/$1/$2');
        $routes->cli('yamoon/(:any)', 'CrawlerController::yamoon/$1');
        $routes->cli('yamoon/(:any)/(:any)', 'CrawlerController::yamoon/$1/$2');
        $routes->cli('sir/(:any)', 'CrawlerController::sir/$1');
        $routes->cli('sir/(:any)/(:any)', 'CrawlerController::sir/$1/$2');
        $routes->cli('inven/(:any)', 'CrawlerController::inven/$1');
        $routes->cli('inven/(:any)/(:any)', 'CrawlerController::inven/$1/$2');
    });
});
