<?php

use CodeIgniter\Router\RouteCollection;
$project = config('Config\\Project');

// Load the system's routing file first, so that the app and ENVIRONMENT
// can override as needed.
if (file_exists(SYSTEMPATH . 'Config/Routes.php')) {
    require SYSTEMPATH . 'Config/Routes.php';
}
/**
 * @var RouteCollection $routes
 */

/*
 * --------------------------------------------------------------------
 * Router Setup
 * --------------------------------------------------------------------
 */
$routes->setDefaultNamespace('App\Controllers');
$routes->setDefaultController('Home');
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(false);
$routes->set404Override();
$routes->setAutoRoute(true);

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

// We get a performance increase by specifying the default
// route since we don't have to scan directories.
$routes->get('/', 'Home::index');
//echo $this->request->uri->getSegment(1);

if(count($project->language_arr) > 1){
	foreach($project->language_arr as $lang_code => $lang_name){
		$routes->group($lang_code, function ($routes) {
			$routes->add('career/', 'Career::index');
			$routes->add('career/apply/(:segment)', 'Career::apply/$1');
			$routes->add('page/(:segment)', 'Page::index/$1');
			$routes->add('search/result', 'Search::result');
			$routes->add('blog', 'Blog::index');
			$routes->add('blog(:segment)', 'Blog::detail/$1');
			$routes->add('news', 'News::index');
			$routes->add('news/(:segment)', 'News::detail/$1');
			$routes->add('download/(:segment)', 'Download::index/$1');
			$routes->add('invester_relations/(:segment)', 'Invester_relations::index/$1');
			$routes->add('product/(:segment)', 'Product::index/$1');
			$routes->add('product/category/(:segment)', 'Product::category/$1');
			$routes->add('photo_album/details/(:segment)', 'Photo_album::details/$1');
			$routes->add('photo_album', 'Photo_album::index');
			$routes->add('video_album/details/(:segment)', 'Video_album::details/$1');
			$routes->add('video_album', 'Video_album::index');			
			
			$routes->get('download', 'Download::index');
            $routes->get('download/file/(:segment)', 'Download::download_file/$1');

			$routes->add('home/', 'Home::index/$1');
			$routes->add('home/appointement_modal', 'Home::appointement_modal');
			$routes->add('enquiry/', 'Enquiry::index');
			$routes->add('get_a_quote/', 'Enquiry::index');
			$routes->add('enquiry/enquiry_modal', 'Enquiry::enquiry_modal');
			$routes->add('Home/send_quick_enquiry', 'Home::send_quick_enquiry');

			$routes->add('locate_us/appointement_modal/(:segment)', 'Locate_us::appointement_modal/$1');
			$routes->add('booking/generateQrCode', 'Booking::generateQrCode');
			
		});
	}
}

$routes->add('news', 'News::index');
$routes->add('news/(:segment)', 'News::detail/$1');
$routes->add('career/', 'Career::index');
$routes->add('career/apply/(:segment)', 'Career::apply/$1');
$routes->add('download', 'Download::index');
$routes->add('page/(:segment)', 'Page::index/$1');
$routes->add('search/result', 'Search::result');
$routes->add('blog', 'Blog::index');
$routes->add('blog(:segment)', 'Blog::detail/$1');

$routes->add('download/(:segment)', 'Download::index/$1');
$routes->add('invester_relations/(:segment)', 'Invester_relations::index/$1');
$routes->add('product/category/(:segment)', 'Product::category/$1');
$routes->add('photo_album/details/(:segment)', 'Photo_album::details/$1');
$routes->add('photo_album', 'Photo_album::index');
$routes->add('video_album/details/(:segment)', 'Video_album::details/$1');
$routes->add('video_album', 'Video_album::index');
$routes->add('home/', 'Home::index');
$routes->add('home/appointement_modal', 'Home::appointement_modal');
$routes->add('locate_us/appointement_modal/(:segment)', 'Locate_us::appointement_modal/$1');

$routes->add('enquiry/', 'Enquiry::index');
$routes->add('get_a_quote/', 'Enquiry::index');
$routes->add('enquiry/enquiry_modal', 'Enquiry::enquiry_modal');
$routes->add('booking/generateQrCode', 'Booking::generateQrCode');



