<?php

namespace Config;

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

/*
 * --------------------------------------------------------------------
 * Router Setup
 * --------------------------------------------------------------------
 */
$routes->setDefaultNamespace('App\Controllers');
$routes->setDefaultController('Member_controller');
$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->match(['get','post'],'/','Member_controller::index');
$routes->match(['get','post'],'/register','Member_controller::register');
$routes->match(['get'],'/member_logout','Member_controller::logout');
$routes->match(['get'],'/members_list','Member_controller::members_list');
$routes->match(['get'],'/member_edit/(:any)','Member_controller::member_edit/$1');
$routes->match(['post'],'/member_edit','Member_controller::member_edit');
$routes->match(['get','post'],'/member_add','Member_controller::member_add');
$routes->match(['get','post'],'/member_address_form','Member_controller::member_address_form');
$routes->match(['get','post'],'/member_address_edit','Member_controller::member_address_edit');
$routes->match(['get','post'],'/member_password_edit','Member_controller::member_password_edit');
$routes->match(['get','post'],'/member_home','Member_controller::member_dashboard');
$routes->match(['get','post'],'/check_old_password','Member_controller::check_old_password');
$routes->match(['get','post'],'/zipcode_data','Member_controller::zipcode_data');

$routes->match(['post'],'/buy_pack','Member_controller::buy_pack');
$routes->match(['post'],'/use_points','Member_controller::use_points');
$routes->match(['post'],'/add_to_cart','Member_controller::add_to_cart');
$routes->match(['post'],'/cart_checkout','Member_controller::cart_checkout');

$routes->match(['get','post'],'/set_password/(:any)','Member_controller::set_password/$1');
$routes->match(['get','post'],'/update_password','Member_controller::update_password');
$routes->match(['get','post'],'/change_password','Member_controller::change_password');
$routes->match(['get','post'],'/change_password_form','Member_controller::change_password_form');
$routes->match(['get','post'],'/member_deactivate/(:any)','Member_controller::member_deactivate/$1');
$routes->match(['get','post'],'/member_activate/(:any)','Member_controller::member_activate/$1');
$routes->match(['get'],'/scheduler','Member_controller::scheduler');


$routes->get('/payment', 'PaymentController::index');
$routes->get('/payment_success/(:any)', 'PaymentController::payment_success/$1');
$routes->get('/payment_failed/(:any)', 'PaymentController::payment_failed/$1');
$routes->post('/payment/(:any)', 'PaymentController::index/$1');
$routes->get('payment_form', 'PaymentController::payment_form');
$routes->post('processPayment', 'PaymentController::processPayment');


$routes->match(['get','post'],'/test','Test_controller::sendEmail');
$routes->match(['get','post'],'/test2','Test_controller::test2');



$routes->match(['get','post'],'/admin','Admin_controller::index');
$routes->match(['get'],'/admin_logout','Admin_controller::admin_logout');
$routes->match(['get'],'/users_list','Admin_controller::users_list');
$routes->match(['get'],'/user_edit/(:any)','Admin_controller::user_edit/$1');
$routes->match(['post'],'/user_edit','Admin_controller::user_edit');
$routes->match(['get','post'],'/user_add','Admin_controller::user_add');
$routes->match(['get'],'/admin_profile/(:any)','Admin_controller::admin_profile/$1');
$routes->match(['post'],'/admin_profile','Admin_controller::admin_profile');
$routes->match(['post'],'/profilepic_insert','Admin_controller::profilepic_insert');
$routes->match(['get'],'/credits_pack_list','Admin_controller::credits_pack_list');
$routes->match(['get'],'/credits_pack_edit/(:any)','Admin_controller::credits_pack_edit/$1');
$routes->match(['post'],'/credits_pack_edit','Admin_controller::credits_pack_edit');
$routes->match(['get','post'],'/credits_pack_add','Admin_controller::credits_pack_add');
$routes->match(['get','post'],'/user_password_change','Admin_controller::user_password_change');
$routes->match(['get','post'],'/user_deactivate/(:any)','Admin_controller::user_deactivate/$1');
$routes->match(['get','post'],'/user_activate/(:any)','Admin_controller::user_activate/$1');
$routes->match(['get'],'/transactions_list/(:any)','Admin_controller::transactions_list/$1');
$routes->match(['get'],'/transactions_list','Admin_controller::transactions_list');
$routes->match(['get','post'],'/user_forgot_password','Admin_controller::user_forgot_password');
$routes->match(['get','post'],'/template_list','Admin_controller::template_list');
$routes->match(['get','post'],'/email_temp','Admin_controller::email_temp');
$routes->match(['get','post'],'/edit_email_temp/(:any)','Admin_controller::edit_email_temp/$1');
$routes->match(['get','post'],'/mail_temp_deactivate/(:any)','Admin_controller::mail_temp_deactivate/$1');
$routes->match(['get','post'],'/mail_temp_activate/(:any)','Admin_controller::mail_temp_activate/$1');
$routes->match(['get','post'],'/rule','Admin_controller::rule');
$routes->match(['get','post'],'/booked_slot','Admin_controller::booked_slot');
$routes->match(['get','post'],'/manage_availability','Admin_controller::manage_availability');
$routes->match(['get','post'],'/add_to_cart_package','Admin_controller::add_to_cart_package');
$routes->match(['post'],'/order_details','Admin_controller::order_details');
$routes->match(['get'],'/view_credit_details/(:any)','Admin_controller::view_credit_details/$1');
$routes->match(['post'],'/update_creditsModel/(:any)','Admin_controller::update_creditsModel/$1');
$routes->match(['get','post'],'/get_pack_list','Admin_controller::get_pack_list');
$routes->match(['get','post'],'/add_creditsModel','Admin_controller::add_creditsModel');

$routes->match(['get'],'/product_list','Admin_controller::product_list');
$routes->match(['get'],'/product_edit/(:any)','Admin_controller::product_edit/$1');
$routes->match(['post'],'/product_edit','Admin_controller::product_edit');
$routes->match(['get','post'],'/product_add','Admin_controller::product_add');

$routes->match(['get'],'/admin_home','Dashboard::admin_home');
// $routes->match(['get'],'/member_home','Dashboard::member_home');


$routes->match(['get'],'fetch_country','Common_controller::fetch_country');
$routes->match(['get','post'],'fetch_state','Common_controller::fetch_state');
$routes->match(['get','post'],'fetch_city','Common_controller::fetch_city');
$routes->match(['get','post'],'/check_if_mail_exists','Common_controller::check_if_mail_exists');
$routes->match(['get','post'],'/forgot_password','Common_controller::forgot_password');



$routes->match(['get','post'],'/mail/(:any)','Sendmail_controller::index/$1');
$routes->match(['get','post'],'/verify_email/(:any)','Sendmail_controller::verify_email/$1');
// $routes->match(['get','post'],'/forgot_password','Sendmail_controller::forgot_password');
$routes->match(['get','post'],'/verify_update_email/(:any)','Sendmail_controller::verify_update_email/$1');


$routes->match(['get','post'],'/membership','Cart_controller::index');
$routes->match(['get','post'],'/add_package_cartdata','Cart_controller::add_package_cartdata');
$routes->match(['get','post'],'/view_cart/(:any)','Cart_controller::view_cart/$1');
$routes->match(['get','post'],'/membership/(:any)','Cart_controller::continue_shopping/$1');

// $routes->match(['get','post'],'/continue_membership/(:any)','Cart_controller::continue_shopping/$1');


$routes->match(['get','post'],'/remove_product/(:any)','Cart_controller::remove_product/$1');
$routes->match(['get','post'],'/change_count_onclick','Cart_controller::change_count_onclick');


$routes->match(['get','post'],'/test/(:any)','Test_controller::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';
}
