<?php

namespace Modules\Redd\Config;

use Config;
// Create a new instance of our RouteCollection class.
$routes = Config\Services::routes();

// Load the system's routing file first, so that the app and ENVIRONMENT
// can override as needed.
if (is_file(SYSTEMPATH . 'Config/Routes.php')) {
    require SYSTEMPATH . 'Config/Routes.php';
}


//setting up Inventory routes.
$routes->group('administrator/redd', ['filter' => ['isLoggedIn', 'checkPermission'], 'namespace' => 'Modules\Redd\Controllers'],   static function($routes)
{
    $routes->get('/', 'Redd::index');
    $routes->get('client-list', 'Redd::getClientsList');
    $routes->get('add-client', 'Redd::addClient');
    $routes->post('add-client', 'Redd::addClient');
    $routes->get('edit-client/(:num)', 'Redd::editClient/$1');
    $routes->post('update-client', 'Redd::updateClient');
    $routes->get('delete-client/(:num)', 'Redd::deleteClient/$1');
    
    $routes->get('single-client/id=(:num)', 'Redd::singleClient/$1');
    $routes->get('edit-project/(:num)', 'Redd::editProject/$1');
    $routes->post('update-project', 'Redd::updateProject');
    $routes->get('projects/get-items/(:any)/(:any)', 'Redd::getItems/$1/$2');
    $routes->post('projects/save-items', 'Redd::saveItems');
    $routes->get('delete-item/(:any)/(:num)', 'Redd::deleteItem/$1/$2');
    $routes->post('projects/carbon-data/add', 'Redd::getCarbonData');
    $routes->get('projects/carbon-data/edit/(:num)', 'Redd::editCarbonData/$1');
    $routes->post('projects/carbon-data/update', 'Redd::updateCarbonData');
    $routes->get('projects/carbon-data/delete/(:num)', 'Redd::deleteCarbonData/$1');
    
    $routes->get('projects', 'Redd::projects');
    $routes->get('projects/carbon-data', 'Redd::showCarbonData');

    $routes->get('settings', 'ReddSettings::index');
    $routes->match(['get', 'post'], 'forests', 'ReddSettings::manageForests');
    $routes->get('delete-forest/(:num)', 'ReddSettings::deleteForest/$1');
    $routes->match(['get', 'post'], 'activities', 'ReddSettings::manageActivities');
    $routes->get('delete-activity/(:num)', 'ReddSettings::deleteActivity/$1');
    $routes->match(['get', 'post'], 'methodologies', 'ReddSettings::manageMethodologies');
    $routes->get('delete-methodology/(:num)', 'ReddSettings::deleteMethodology/$1');
    $routes->match(['get', 'post'], 'gases', 'ReddSettings::manageGases');
    $routes->get('delete-gas/(:num)', 'ReddSettings::deleteGas/$1');
    $routes->match(['get', 'post'], 'carbon-pools', 'ReddSettings::manageCarbonPools');
    $routes->get('delete-carbon/(:num)', 'ReddSettings::deleteCarbonPool/$1');
    $routes->match(['get', 'post'], 'entity-types', 'ReddSettings::manageEntityTypes');
    $routes->get('delete-entity/(:num)', 'ReddSettings::deleteEntityType/$1');
    $routes->match(['get', 'post'], 'project-types', 'ReddSettings::manageProjectTypes');
    $routes->get('delete-projecttype/(:num)', 'ReddSettings::deleteProjectType/$1');
    $routes->match(['get', 'post'], 'project-statuses', 'ReddSettings::manageProjectStatuses');
    $routes->get('delete-projectstatus/(:num)', 'ReddSettings::deleteProjectStatus/$1');
    
    

});
