<?php

use CodeIgniter\Router\RouteCollection;

/** @var RouteCollection $routes */

/* Rutas para tarifas */
$routes->group('tarifas', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {

    /* Maquinas */
    $routes->group('maquinas', ['namespace' => 'App\Controllers\Tarifas\Maquinas'], function ($routes) {

        $routes->post('acabado', 'TarifaMaquinas::add_tarifa_acabado_maquina_with_tarea');
        $routes->post('manipulado', 'TarifaMaquinas::add_tarifa_manipulado_maquina_with_tarea');
        $routes->post('preimpresion', 'TarifaMaquinas::add_tarifa_preimpresion_maquina_with_tarea');
        $routes->post('encuadernacion', 'TarifaMaquinas::add_tarifa_encuadernacion_maquina_with_tarea');
        $routes->post('extra', 'TarifaMaquinas::add_tarifa_extra_maquina_with_tarea');


        $routes->delete('acabado/(:num)', 'TarifaMaquinas::delete_tarifa_acabado_maquina_with_tarea/$1');
        $routes->delete('manipulado/(:num)', 'TarifaMaquinas::delete_tarifa_manipulado_maquina_with_tarea/$1');
        $routes->delete('preimpresion/(:num)', 'TarifaMaquinas::delete_tarifa_preimpresion_maquina_with_tarea/$1');
        $routes->delete('encuadernacion/(:num)', 'TarifaMaquinas::delete_tarifa_encuadernacion_maquina_with_tarea/$1');
        $routes->delete('extra/(:num)', 'TarifaMaquinas::delete_tarifa_extra_maquina_with_tarea/$1');

        $routes->get('acabado/select', 'TarifaMaquinas::get_select_maquina_acabado');
        $routes->get('manipulado/select', 'TarifaMaquinas::get_select_maquina_manipulado');
        $routes->get('impresion/select', 'TarifaMaquinas::get_select_maquina_impresion');
        $routes->get('encuadernacion/select', 'TarifaMaquinas::get_select_maquina_manipulado');
        $routes->get('tareas/select', 'TarifaMaquinas::get_select_maquina_tareas');

        $routes->get('acabado/datatable/(:num)', 'TarifaMaquinas::get_datatable_tarifa_acabado_maquina/$1');
        $routes->get('manipulado/datatable/(:num)', 'TarifaMaquinas::get_datatable_tarifa_manipulado_maquina/$1');
        $routes->get('preimpresion/datatable/(:num)', 'TarifaMaquinas::get_datatable_tarifa_preimpresion_maquina/$1');
        $routes->get('encuadernacion/datatable/(:num)', 'TarifaMaquinas::get_datatable_tarifa_encuadernacion_maquina/$1');
        $routes->get('extra/datatable/(:num)', 'TarifaMaquinas::get_datatable_tarifa_extra_maquina/$1');
    });

    /* Acabados */
    $routes->group('acabados', ['namespace' => 'App\Controllers\Tarifas\Acabados'], function ($routes) {

        $routes->get('', 'TarifaAcabados::index', ['as' => 'tarifaAcabadoList']);
        $routes->get('gettarifas', 'TarifaAcabados::getSelect2');
        $routes->match(['get', 'post'], 'add', 'TarifaAcabados::add', ['as' => 'tarifaAcabadoAdd']);
        $routes->match(['get', 'post'], 'edit/(:num)', 'TarifaAcabados::edit/$1', ['as' => 'tarifaAcabadoEdit']);
        $routes->get('delete/(:num)', 'TarifaAcabados::delete/$1', ['as' => 'tarifaAcabadoDelete']);
        $routes->post('datatable', 'TarifaAcabados::datatable', ['as' => 'tarifaAcabadoDT']);
        $routes->get('select', 'TarifaAcabados::show_select', ["as" => "showSelectTarifaAcabado"]);
        $routes->group('lineas', ['namespace' => 'App\Controllers\Tarifas\Acabados'], function ($routes) {
            $routes->post('datatable', 'TarifaAcabadosLineas::datatable', ['as' => 'tarifaAcabadoLineasDT']);
            $routes->post('datatable_editor', 'TarifaAcabadosLineas::datatable_editor', ['as' => 'tarifaAcabadoLineasDTE']);
            $routes->get('delete/(:num)', 'TarifaAcabadosLineas::delete/$1', ['as' => 'tarifaAcabadoLineasDelete']);
        });
    });
});