<?php

use CodeIgniter\Router\RouteCollection;

/**
 * @var RouteCollection $routes
 */
// $routes->get('inputtypes','InputTypes::index');
// $routes->get('callviewmultipletimes','CallViewMultipleTimes::index');
// $routes->get('IncludeOneViewInAnother','IncludeOneViewInAnother::index');
// $routes->get('extendlayout','ExtendLayout::index');
// $routes->get('inputtypes/(:num)','InputTypes::show/$1');
// $routes->get('inputtypes/new','InputTypes::new',["as"=>"new_inputtype"]);
// $routes->post("inputtypes","InputTypes::create");
// $routes->get('inputtypes/(:num)/edit','InputTypes::edit/$1');
// $routes->patch("inputtypes/(:num)","InputTypes::update/$1");
// $routes->delete("inputtypes/(:num)", "InputTypes::delete/$1");

//$routes->resource("categories",["placeholder"=>"(:num)", "filter" => "\App\Filters\Login::class"]);



//$routes->post("production/postgreencoffees","Production::postgreencoffees");
//$routes->post('InputCosts/peek','InputCosts::peekList');


service('auth')->routes($routes);

$routes->group("",["filter" => "\App\Filters\Login::class"], static function ($routes) {
//$routes->group("",["filter" => "session"], static function ($routes) {
        $routes->get("set-password","Password::set");
    $routes->post("set-password","Password::update");

    $routes->get("change-password","Password::change");
    $routes->post("change-password","Password::changeUpdate");

    $routes->get("reset-password/(:num)","Password::reset/$1");
    $routes->post("reset-password/(:num)","Password::resetUpdate/$1");

    $routes->get('/', 'Home::index');

    $routes->get('test','Production::test');

    $routes->get('greencoffees','GreenCoffees::index');
    $routes->get('greencoffees/new','GreenCoffees::new');
    $routes->post("greencoffees","GreenCoffees::create");
    $routes->get('greencoffees/(:num)/edit','GreenCoffees::edit/$1');
    $routes->patch("greencoffees/(:num)","GreenCoffees::update/$1");
    $routes->post('greencoffees/delete','GreenCoffees::delete');
//    $routes->post('greencoffees/getcertsforcoffee','GreenCoffees::getcertsforcoffee');
    $routes->post("greencoffees/getgreencoffees","GreenCoffees::getgreencoffees");

    $routes->get('production','Production::index');
    $routes->get('production/new','Production::new');
    $routes->post("production","Production::create");
    $routes->get('production/(:num)/edit','Production::edit/$1');
    $routes->patch("production/(:num)","Production::update/$1");
    $routes->post('production/delete','Production::delete');
    $routes->post('production/getcertsforcoffee','Production::getcertsforcoffee');
    $routes->post("production/getgreencoffees","Production::getgreencoffees");
    $routes->post("production/(:num)/update","Production::submitPost/$1");


    $routes->get('pricelist/(:num)', 'Pricelists::pricelist/$1');
    $routes->get('PricelistCustomer/(:num)', 'PricelistCustomer::pricelist/$1');


    $routes->get('checklist', 'Recipes::checklist');

    $routes->get("Categories/(:num)/delete","Categories::confirmDelete/$1");
    $routes->get('Categories/(:num)/edit/(:num)','Categories::edit/$1/$2');
    $routes->patch("Categories/(:num)/(:num)","Categories::update/$1/$2");
    $routes->resource("categories",["placeholder"=>"(:num)"]);

    $routes->get("Inputtypes/(:num)/delete","Inputtypes::confirmDelete/$1");
    $routes->resource("inputtypes",["placeholder"=>"(:num)"]);

    $routes->get("Certifications/(:num)/delete","Certifications::confirmDelete/$1");
    $routes->resource("certifications",["placeholder"=>"(:num)"]);

    $routes->get("Countries/(:num)/delete","Countries::confirmDelete/$1");
    $routes->resource("countries",["placeholder"=>"(:num)"]);

    $routes->get("Processes/(:num)/delete","Processes::confirmDelete/$1");
    $routes->resource("processes",["placeholder"=>"(:num)"]);

    $routes->get("Suppliers/(:num)/delete","Suppliers::confirmDelete/$1");
    $routes->resource("suppliers",["placeholder"=>"(:num)"]);

    $routes->get("Roastlevels/(:num)/delete","Roastlevels::confirmDelete/$1");
    $routes->resource("roastlevels",["placeholder"=>"(:num)"]);

    $routes->get("RoastColours/(:num)/delete","RoastColours::confirmDelete/$1");
    $routes->resource("RoastColours",["placeholder"=>"(:num)"]);


    $routes->get("Inputs/(:num)/delete","Inputs::confirmDelete/$1");
    $routes->resource("inputs",["placeholder"=>"(:num)"]);

    $routes->get("InputCosts/(:num)","InputCosts::index/$1");
    $routes->get("InputCosts/new/(:num)","InputCosts::new/$1");
    $routes->get("InputCosts/(:num)/edit","InputCosts::edit/$1");
    $routes->patch("InputCosts/(:num)","InputCosts::update/$1");
    $routes->post("InputCosts","InputCosts::create");
    $routes->post('InputCosts/delete','InputCosts::delete');

    $routes->get("InputCosts/test","InputCosts::test");
    $routes->post('InputCosts/peek','InputCosts::peekList');
    $routes->post('InputCosts/htmxinputvalidfromdates','InputCosts::htmxInputValidFromDates');

    $routes->get("Recipes/(:num)/delete","Recipes::confirmDelete/$1");
    $routes->get("Recipes/print/(:num)","Recipes::print/$1");
    $routes->resource("recipes",["placeholder"=>"(:num)"]);
    $routes->post("recipes/bom/(:num)","Recipes::bom/$1");
    $routes->post("recipes/(:num)/uploadimage/(:num)","Recipes::uploadimage/$1/$2");
    $routes->get("Recipes/(:num)/imageedit","Recipes::imageedit/$1");
    $routes->get("Recipes/(:num)/imagedelete","Recipes::imagedelete/$1");
    $routes->get("Recipes/(:num)/imagesetdefault","Recipes::imagesetdefault/$1");
    $routes->post("Recipes/htmxDelete","Recipes::htmxDelete");

    $routes->get("recipeinputs/(:num)/(:num)/delete","Recipeinputs::delete/$1/$2");
    $routes->post("recipeinputs/(:num)","Recipeinputs::create/$1");

    $routes->get("Templates/(:num)/delete","Templates::confirmDelete/$1");
    $routes->resource("templates",["placeholder"=>"(:num)"]);

    $routes->get("templateinputs/(:num)/(:num)/delete","Templateinputs::delete/$1/$2");
    $routes->post("templateinputs/(:num)","Templateinputs::create/$1");


    $routes->get('coffeedemand/(:num)','Coffeedemand::index/$1');
    $routes->get('coffeedemand/(:num)/export','Coffeedemand::export/$1');

    $routes->get("Users/(:num)/delete","Users::confirmDelete/$1");
    $routes->resource("users",["placeholder"=>"(:num)"]);

    $routes->get("allsettings/(:num)/imagedelete","Allsettings::imagedelete/$1");
    $routes->post("allsettings/uploadimage","Allsettings::uploadImage");
    $routes->post("allsettings","Allsettings::update");
    $routes->resource("allsettings",["placeholder"=>"(:num)"]);





    $routes->get('qualitycontrol/(:num)/edit','QualityControl::edit/$1');

});



//$routes->resource("recipeinputs",["placeholder"=>"(:num)"]);
