<?php

namespace Config;

// Create a new instance of our RouteCollection class.
$routes = 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';
}

/*
 * --------------------------------------------------------------------
 * Router Setup
 * --------------------------------------------------------------------
 */
$routes->setDefaultNamespace('App\Controllers');
$routes->setDefaultController('Home');
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(false);
$routes->set404Override();
// The Auto Routing (Legacy) is very dangerous. It is easy to create vulnerable apps
// where controller filters or CSRF protection are bypassed.
// If you don't want to define all routes, please use the Auto Routing (Improved).
// Set `$autoRoutesImproved` to true in `app/Config/Feature.php` and set the following to true.
//$routes->setAutoRoute(false);

/*
 * --------------------------------------------------------------------
 * Route Definitions
 * --------------------------------------------------------------------
 */

// We get a performance increase by specifying the default
// route since we don't have to scan directories.
//$routes->options('(:any)', 'PreFlight::options');
$routes->get('/', 'Home::index');
$routes->post('/loginadmin', 'Registry::loginadmin');
$routes->post('/loginuser', 'Registry::loginuser');
$routes->post('/logingeneral', 'Registry::logingeneral');

$routes->post('/signupuser', 'Registry::signupuser');


// $routes->post('/loginuser', 'LoginUser::index');
// $routes->post('/loginvendor', 'LoginUser::vendor');
// $routes->post('/setvendorpass', 'LoginUser::setvendorpass');

$routes->post('/getallvehiclemakes', 'GetAllVehicleMakes::index');
$routes->post('/getallvehiclefueltypes', 'GetAllVehicleFuelTypes::index');
$routes->post('/getengineseatings', 'GetEngineSeatings::index');
$routes->post('/getmodulecats', 'GetModuleCats::index');
$routes->post('/getmodulesbycat', 'GetModulesByCat::index');

$routes->post('/getmodelsbymake', 'GetModelsByMake::index');
$routes->post('/getenginesbydetails', 'GetEnginesByDetails::index');
$routes->post('/getyearsbydetails', 'GetYearsByDetails::index');
$routes->post('/getvehiclebyvin', 'GetVehicleByVIN::index');
$routes->post('/getvehiclesbydetails', 'GetVehiclesByDetails::index');
$routes->post('/getpartsbydetails', 'GetPartsByDetails::index');

$routes->post('/getplugbrands', 'Plugs::getbrands');
$routes->post('/getpluglocalrefs', 'GetPlugLocalRefs::index');
$routes->post('/getplugtypes', 'GetPlugTypes::index');

$routes->post('/addmake', 'AddMake::index');
$routes->post('/addmodel', 'AddModel::index');
$routes->post('/addbody', 'AddBody::index');
$routes->post('/addfueltype', 'AddFuelType::index');
$routes->post('/addengseating', 'AddEngSeating::index');
$routes->post('/addengdescription', 'AddEngDescription::index');

$routes->post('/addplugbrand', 'AddPlugBrand::index');
$routes->post('/addpluglocalref', 'AddPlugLocalRef::index');
$routes->post('/addplugtype', 'AddPlugType::index');
$routes->post('/addplugdescription', 'AddPlugDescription::index');
$routes->post('/addplugnote', 'AddPlugNote::index');

$routes->post('/addprice', 'Plugs::addprice');
$routes->post('/addspecificprice', 'Plugs::addspecificprice');

$routes->post('/addmodulecat', 'AddModuleCat::index');
$routes->post('/addmodule', 'AddModule::index');

$routes->post('/adddatasource', 'AddDataSource::index');


$routes->post('/registeruser', 'RegisterUser::index');
$routes->post('/getmodels', 'GetModels::index');

$routes->post('/getfilteredoptions', 'Misc::getfilteredoptions');
$routes->post('/getfilteredclients', 'Misc::getfilteredclients');
$routes->post('/getextraslen_vfam', 'GetExtras::len_vfam');
$routes->post('/getextrasvinprefix', 'GetExtras::vinprefix');
$routes->post('/getbothprices', 'GetExtras::bothprices');

$routes->post('/getregions', 'GetExtras::regions');
$routes->post('/getdistricts', 'GetExtras::districts');
$routes->post('/gettowns', 'GetExtras::towns');
$routes->post('/gettownsofregion', 'GetExtras::townsofregion');

$routes->post('/getautoplusvendor', 'GetExtras::getautoplusvendor');

$routes->post('/getprice', 'GetExtras::price');

$routes->post('/addvendor', 'Setups::addvendor');
$routes->post('/addclient', 'GetExtras::newclient');
$routes->post('/addcustomer', 'GetExtras::newcustomer');
$routes->post('/addstaff', 'GetExtras::newstaff');
$routes->post('/getproductmans', 'GetExtras::getproductmans');
$routes->post('/getproductmansbysupplier', 'GetExtras::getproductmansbysupplier');
$routes->post('/getproductpartnos', 'GetExtras::getproductpartnos');

$routes->post('/getplugnotes', 'GetPlugNotes::index');
$routes->post('/getdatasources', 'GetDataSources::index');

$routes->post('/getvehiclebodies', 'GetVehicleBodies::index');

$routes->post('/addvehicle', 'AddVehicle::index');

$routes->post('/geteditablesources', 'GetEditableSources::index');
$routes->post('/geteditablesourcefields', 'GetEditableSourceFields::index');
$routes->post('/geteditablerows', 'GetEditableRows::index');

$routes->post('/setfieldvalue', 'SetFieldValue::index');

$routes->post('/addcompletion', 'AddCompletion::index');

$routes->post('/getsourcesandfields', 'Geneditor::getsourcesandfields');
$routes->post('/getsourcerows', 'Geneditor::getsourcerows');
$routes->post('/updatefield', 'Geneditor::updatefield');

$routes->post('/loaddata', 'Geneditor::loaddata');

$routes->post('/simpleform', 'SimpleForm::index');
$routes->post('/collectinfo', 'SimpleForm::collectinfo');

$routes->post('/completevendorsale', 'Pos::completevendorsale');

$routes->post('/loadothervendors', 'Transfers::loadothervendors');
$routes->post('/posttransfer', 'Transfers::posttransfer');
$routes->post('/postoverseastransfer', 'Transfers::postoverseastransfer');
$routes->post('/getpostedtransfers', 'Transfers::getpostedtransfers');

$routes->post('/getsuppliers', 'Transfers::getsuppliers');

$routes->post('/getallvendors', 'Reports::getallvendors');
$routes->post('/getdailysales', 'Reports::getdailysales');
$routes->post('/getplugapplicables', 'Reports::getplugapplicables');

//MISC OPS
$routes->post('/mops_matchandreplace', 'MopsEngines::matchandreplace');
$routes->post('/mops_minandmax', 'MopsEngines::minandmax');
$routes->post('/mops_checkstatus', 'MopsEngines::checkstatus');

$routes->post('/getspecificprice', 'Plugs::getspecificprice');
$routes->post('/getmatchedvehiclesbypartno', 'Plugs::getmatchedvehiclesbypartno');

//QUICK FIX
$routes->post('/qfgetvehicledetails', 'Plugs::qfgetvehicledetails');
$routes->post('/qfsavevehicledetailstoplugs', 'Plugs::qfsavevehicledetailstoplugs');

$routes->post('/qfgetplugdetails', 'Plugs::qfgetplugdetails');
$routes->post('/qfsaveplugdetailstoplugs', 'Plugs::qfsaveplugdetailstoplugs');
$routes->post('/qfsaveoemdetailtoplugs', 'Plugs::qfsaveoemdetailtoplugs');
$routes->post('/qfsavepluginputstoplugs', 'Plugs::qfsavepluginputstoplugs');

$routes->post('/qfgetvehicledetails_whole', 'Vehicle::qfgetvehicledetails_whole');
$routes->post('/qfmaytgenerations', 'Vehicle::qfmaytgenerations');
$routes->post('/qfgetmayt', 'Vehicle::qfgetmayt');
$routes->post('/qfsaveserial', 'Vehicle::qfsaveserial');


// $routes->match(['get', 'post'], 'imageRender/(:segment)', 'ImageRenderer::index/$1');

/*
 * --------------------------------------------------------------------
 * Additional Routing
 * --------------------------------------------------------------------
 *
 * There will often be times that you need additional routing and you
 * need it to be able to override any defaults in this file. Environment
 * based routes is one such time. require() additional route files here
 * to make that happen.
 *
 * You will have access to the $routes object within that file without
 * needing to reload it.
 */
if (is_file(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) {
    require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
}
