<?php

use CodeIgniter\Router\RouteCollection;

/**
 * @var RouteCollection $routes
 */
$routes->get('swagger', 'SwaggerController::view');
$routes->get('swagger/json', 'SwaggerController::generate');


 //saml apis
$routes->get('/landingpage', 'SamlController::index');
$routes->get('login', 'SamlController::login');
$routes->post('acs', 'SamlController::acs');
$routes->post('logout', 'SamlController::slo');
$routes->get('metadata', 'SamlController::metadata');

$routes->get('auth/msRedirectionHandler', 'AuthController::msRedirectionHandler');

$routes->group('api', ['filter' => 'appSignature'], function ($routes) {

  // Login api
  $routes->post('auth/login', 'AuthController::login');
  $routes->get('auth/oauthClient', 'AuthController::oauthClient');
  $routes->post('auth/oauthlogin', 'AuthController::oauthlogin');
  $routes->get('auth/logout', 'AuthController::logout');


  // MS OAuth api's
  $routes->get('auth/mslogin', 'AuthController::mslogin');
  $routes->get('auth/verifyMSAuthUser', 'AuthController::verifyMSAuthUser');

  // Google OAuth api's
  $routes->get('googleoauth', 'AuthController::receiveGoogleOAuthResponse');
  $routes->get('auth/googlelogin', 'AuthController::initiateGoogleOAuth');
  $routes->get('logout', 'AuthController::logout');

  //forgot password
  $routes->post('forgotPassword/verifyUser', 'UserController::verifyUser');
  $routes->post('forgotPassword/changePassword', 'UserController::forgotChangePassword');

});

$routes->group('api', ['filter' => ["jwtAuth:Org Admin,Travel Admin,Travel Agent,User","appSignature"] ], function ($routes) {



  $routes->get('downloadPassport', 'UserController::downloadPassport');

  $routes->get('organizations/find/(:num)', 'OrganizationController::find/$1');  // Org admin, Travel admin, Travel agent,user
  $routes->get('users/find/(:num)', 'UserController::find/$1');   // Org admin, Travel admin, Travel agent,user
  $routes->post('plans/createOrEditPlan', 'PlanController::createOrEditPlan'); // Org admin, Travel admin, Travel agent,user
  $routes->post('plans/getForexPerdiem', 'PlanController::getForexPerdiem');  // Org admin, Travel admin, Travel agent,user
  $routes->get('plans/download', 'PlanController::downloadPlan');// Org admin, Travel admin, Travel agent,user
  $routes->get('plans/getRemarksByPlanId', 'PlanController::getRemarksByPlanId'); // Org admin, Travel admin, Travel agent,user
  $routes->get('plans/forexDownload', 'PlanController::forexDownload');  // Org admin, Travel admin, Travel agent,user
  $routes->get('plans/cancle_plan', 'PlanController::canclePlan'); // Org admin, Travel admin, Travel agent,user
  $routes->get('plans/get_plan_approval_status', 'PlanController::get_plan_approval_status');  // Org admin, Travel admin, Travel agent,user
  $routes->get('plans/planInfo', 'PlanController::planInfo');  // Org admin, Travel admin, Travel agent,user
  $routes->get('getCostCenterMaster', 'MasterController::getCostCenterMaster'); // Org admin, Travel admin, Travel agent,user
  $routes->get('getRoles', 'UserController::roleList');  // Org admin, Travel admin, Travel agent,user

  //Master
  $routes->get('getDropdownMaster', 'MasterController::getDropdownMaster');  // Org admin, Travel admin, Travel agent,user
  $routes->get('getTravelStatusMaster', 'MasterController::getTravelStatusMaster');
  $routes->get('getcountryMaster', 'MasterController::getcountryMaster'); // Org admin, Travel admin, Travel agent,user
  $routes->get('getAirportCodeMaster', 'MasterController::getAirportCodeMaster');// Org admin, Travel admin, Travel agent,user
  $routes->get('getAirlineMaster', 'MasterController::getAirlineMaster'); // Org admin, Travel admin, Travel agent,user
  $routes->get('getTrainCodeMaster', 'MasterController::getTrainCodeMaster');// Org admin, Travel admin, Travel agent,user
  $routes->get('getFlightAndTrainClass', 'MasterController::getFlightAndTrainClass');// Org admin, Travel admin, Travel agent,user
  $routes->get('getDepartmentList', 'MasterController::getDepartmentList'); // Org admin, Travel admin,Travel agent,user

  $routes->get('user/refreshUserToken', 'AuthController::refreshUserToken');
  $routes->get('service', 'OrganizationController::getServices');
  $routes->get('groups', 'OrganizationController::getGroups');
  $routes->put('groups/group-status/(:num)', 'OrganizationController::updateGroupStatus/$1');
  $routes->put('policy/policy-status/(:num)', 'OrganizationController::updatePolicyStatus/$1');
  $routes->get('users', 'UserController::index');
  $routes->get('agentList', 'UserController::agentList');
  $routes->put('user/user-status/(:num)', 'UserController::updateUserStatus/$1');
  $routes->get('checkDuplicate', 'UserController::checkDuplicate');
  $routes->get('travellers', 'TravellerController::index');
  $routes->get('travellers/find/name/(:any)', 'TravellerController::findByName/$1');
  $routes->get('travellers/find/email/(:any)', 'TravellerController::findByEmail/$1');
  $routes->get('travellers/find/mobile/(:any)', 'TravellerController::findByMobile/$1');
  
  $routes->put('plans/find/(:num)', 'PlanController::find/$1');
  $routes->get('plans/view', 'PlanController::viewPlan');
  $routes->get('plans/plan_pdf', 'PlanController::plan_pdf');
  $routes->get('plans/plan_policy_action_status', 'PlanController::plan_policy_action_status');
  $routes->get('getHotels', 'MasterController::getHotels');



});




$routes->group('api', ['filter' => ["jwtAuth:Org Admin,Travel Admin,User","appSignature"] ], function ($routes) {

  $routes->post('travellers/create', 'TravellerController::create');  // Org admin, Travel admin,user
  $routes->post('plans/approvePlan', 'PlanController::approvePlan');  // Org admin, Travel admin,user
  $routes->post('plans/rejectPlan', 'PlanController::rejectPlan'); // Org admin, Travel admin,user
  $routes->get('plans/findApprovalList', 'PlanController::findApprovalList'); // Org admin, Travel admin,user
  $routes->get('plans', 'PlanController::userPlans');


});

$routes->group('api', ['filter' => ["jwtAuth:Org Admin,Travel Admin","appSignature"] ], function ($routes) {

  $routes->get('groups/find/(:num)', 'OrganizationController::findGroup/$1'); // Org admin, Travel admin,
  $routes->post('groups/create', 'OrganizationController::createGroup');// Org admin, Travel admin,
  $routes->put('groups/update/(:num)', 'OrganizationController::updateGroup/$1');// Org admin, Travel admin,
  $routes->get('policy', 'OrganizationController::getPolicy'); // Org admin, Travel admin,
  $routes->get('policy/find/(:num)', 'OrganizationController::findPolicy/$1');// Org admin, Travel admin,
  $routes->post('policy/createOrUpdate', 'OrganizationController::createOrUpdatePolicy');// Org admin, Travel admin,
  $routes->post('users/create', 'UserController::create'); // Org admin, Travel admin,
  $routes->put('users/update/(:num)', 'UserController::update/$1'); // Org admin, Travel admin,
  $routes->put('user/user-password/(:num)', 'UserController::changePassword/$1'); // Org admin, Travel admin,
  $routes->post('user/userUpload','UserController::userUpload');  // Org admin, Travel admin,
  $routes->get('user/userUploadTemplate','UserController::userUploadTemplate');  // Org admin, Travel admin,
  $routes->get('travellers/find', 'TravellerController::find'); // Org admin, Travel admin,
  $routes->put('travellers/update/(:num)', 'TravellerController::update/$1'); // Org admin, Travel admin,
  $routes->get('plans/statusDashboard', 'PlanController::statusDashboard'); // Org admin, Travel admin,
  $routes->post('createCostCenter', 'MasterController::createCostCenter');  // Org admin, Travel admin,
  $routes->get('findCostCenter', 'MasterController::findCostCenter');  // Org admin, Travel admin,
  $routes->put('updateCostCenter/(:num)', 'MasterController::updateCostCenter/$1'); // Org admin, Travel admin,
     // Department Master
     $routes->post('createDepartment', 'MasterController::createDepartment');// Org admin, Travel admin,
     $routes->get('findDepartment', 'MasterController::findDepartment');// Org admin, Travel admin,
     $routes->put('updateDepartment/(:num)', 'MasterController::updateDepartment/$1'); // Org admin, Travel admin,
     // Purpose of travel Master
     $routes->get('getPurposeOfTravelList', 'MasterController::getPurposeOfTravelList'); // Org admin, Travel admin,
     $routes->post('createPurposeOfTravel', 'MasterController::createPurposeOfTravel');// Org admin, Travel admin,
     $routes->get('findPurposeOfTravel', 'MasterController::findPurposeOfTravel'); // Org admin, Travel admin,
     $routes->put('updatePurposeOfTravel/(:num)', 'MasterController::updatePurposeOfTravel/$1');// Org admin, Travel admin,
     // Forex Master
     $routes->get('getForexPerdiemList', 'MasterController::getForexPerdiemList');
     $routes->post('createForexPerdiem', 'MasterController::createForexPerdiem'); // Org admin, Travel admin,
     $routes->get('findForexPerdiem', 'MasterController::findForexPerdiem'); // Org admin, Travel admin,
     $routes->put('updateForexPerdiem/(:num)', 'MasterController::updateForexPerdiem/$1');// Org admin, Travel admin,
     $routes->post('forex_signature_upload', 'MasterController::forex_signature_upload');// Org admin, Travel admin,
     $routes->get('getForexSignaturePath', 'MasterController::getForexSignaturePath');// Org admin, Travel admin,
     // Hotels Master
     $routes->post('createHotels', 'MasterController::createHotels');// Org admin, Travel admin,
     $routes->get('findHotels', 'MasterController::findHotels');// Org admin, Travel admin,
     $routes->put('updateHotels/(:num)', 'MasterController::updateHotels/$1');// Org admin, Travel admin,
  
  
     //mail template
     $routes->get('template', 'EmailTemplateController::index'); // Org admin, Travel admin,
     $routes->put('template/find/(:num)', 'EmailTemplateController::find/$1');// Org admin, Travel admin,
     $routes->post('template/create', 'EmailTemplateController::create');// Org admin, Travel admin,
     $routes->put('template/update/(:num)', 'EmailTemplateController::update/$1');// Org admin, Travel admin,
     $routes->get('getForexTemplate', 'EmailTemplateController::getForexTemplate');// Org admin, Travel admin,
  
     $routes->post('advancePurchaseReport', 'ReportsController::advancePurchaseReport');// Org admin, Travel admin,
     $routes->post('misServicesAnalysis', 'ReportsController::misServicesAnalysis');// Org admin, Travel admin,
     $routes->post('misAirReport', 'ReportsController::misAirReport');// Org admin, Travel admin,
     $routes->post('misHotelReport', 'ReportsController::misHotelReport');// Org admin, Travel admin,
     $routes->post('misForexReport', 'ReportsController::misForexReport');// Org admin, Travel admin,
     $routes->post('guestHouseReport', 'ReportsController::guestHouseReport');// Org admin, Travel admin,

     $routes->get('allPlans', 'PlanController::allPlans');

});

$routes->group('api', ['filter' => ["jwtAuth:Org Admin","appSignature"] ], function ($routes) {

   //Organization
   $routes->get('organizations', 'OrganizationController::index');
   $routes->post('organizations/create', 'OrganizationController::create'); // Org admin,
   $routes->put('organizations/update/(:num)', 'OrganizationController::update/$1');// Org admin,
   $routes->put('organizations/org-status/(:num)', 'OrganizationController::updateOrganizationStatus/$1');
   $routes->post('organizations/testMail', 'OrganizationController::testMail'); // Org admin,


});

$routes->group('api', ['filter' => ["jwtAuth:Travel Agent","appSignature"] ], function ($routes) {

  $routes->get('plans/findTravelAgentPlanList', 'PlanController::findTravelAgentPlanList');//Travel agent
  $routes->post('plans/addOrEditPlanRemark', 'PlanController::addOrEditPlanRemark');//Travel agent

});







//api's with token
//  $routes->group('api', ['filter' => ["jwtAuth","appSignature"] ], function ($routes) {

//    $routes->get('user/refreshUserToken', 'AuthController::refreshUserToken');


//     //Organization
//     $routes->get('organizations', 'OrganizationController::index');
//     $routes->get('organizations/find/(:num)', 'OrganizationController::find/$1');
//     $routes->post('organizations/create', 'OrganizationController::create');
//     $routes->put('organizations/update/(:num)', 'OrganizationController::update/$1');
//     $routes->put('organizations/org-status/(:num)', 'OrganizationController::updateOrganizationStatus/$1');
//     $routes->post('organizations/testMail', 'OrganizationController::testMail');

//     //Service 
//     $routes->get('service', 'OrganizationController::getServices');

//     //Group 
//     $routes->get('groups', 'OrganizationController::getGroups');
//     $routes->get('groups/find/(:num)', 'OrganizationController::findGroup/$1');
//     $routes->post('groups/create', 'OrganizationController::createGroup');
//     $routes->put('groups/update/(:num)', 'OrganizationController::updateGroup/$1');
//     $routes->put('groups/group-status/(:num)', 'OrganizationController::updateGroupStatus/$1');

//     //Policy 
//     $routes->get('policy', 'OrganizationController::getPolicy');
//     $routes->get('policy/find/(:num)', 'OrganizationController::findPolicy/$1');
//     $routes->post('policy/createOrUpdate', 'OrganizationController::createOrUpdatePolicy');
//     $routes->put('policy/policy-status/(:num)', 'OrganizationController::updatePolicyStatus/$1');

//     //User
//     $routes->get('users', 'UserController::index');
//     $routes->get('agentList', 'UserController::agentList');
//     $routes->get('users/find/(:num)', 'UserController::find/$1');
//     $routes->post('users/create', 'UserController::create');
//     $routes->put('users/update/(:num)', 'UserController::update/$1');
//     $routes->put('user/user-status/(:num)', 'UserController::updateUserStatus/$1');
//     $routes->put('user/user-password/(:num)', 'UserController::changePassword/$1');
//     $routes->get('checkDuplicate', 'UserController::checkDuplicate');
//     $routes->post('user/userUpload','UserController::userUpload');
//     $routes->get('user/userUploadTemplate','UserController::userUploadTemplate');


//     //Traveller
//     $routes->get('travellers', 'TravellerController::index');
//     $routes->post('travellers/create', 'TravellerController::create');
//     $routes->get('travellers/find', 'TravellerController::find');
//     $routes->put('travellers/update/(:num)', 'TravellerController::update/$1');
//     $routes->get('travellers/find/name/(:any)', 'TravellerController::findByName/$1');
//     $routes->get('travellers/find/email/(:any)', 'TravellerController::findByEmail/$1');
//     $routes->get('travellers/find/mobile/(:any)', 'TravellerController::findByMobile/$1');


//     //Plan
//     $routes->get('plans', 'PlanController::index');
//     $routes->put('plans/find/(:num)', 'PlanController::find/$1');
//     $routes->post('plans/createOrEditPlan', 'PlanController::createOrEditPlan');
//     $routes->post('plans/getForexPerdiem', 'PlanController::getForexPerdiem');
//     $routes->post('plans/approvePlan', 'PlanController::approvePlan');
//     $routes->post('plans/rejectPlan', 'PlanController::rejectPlan');
//     $routes->get('plans/statusDashboard', 'PlanController::statusDashboard');
//     $routes->get('plans/download', 'PlanController::downloadPlan');
//     $routes->get('plans/view', 'PlanController::viewPlan');
//     $routes->get('plans/findApprovalList', 'PlanController::findApprovalList');
//     $routes->get('plans/findTravelAgentPlanList', 'PlanController::findTravelAgentPlanList');
//     $routes->post('plans/addOrEditPlanRemark', 'PlanController::addOrEditPlanRemark');
//     $routes->get('plans/getRemarksByPlanId', 'PlanController::getRemarksByPlanId');
//     $routes->get('plans/forexDownload', 'PlanController::forexDownload');
//     $routes->get('plans/cancle_plan', 'PlanController::canclePlan');
//     $routes->get('plans/get_plan_approval_status', 'PlanController::get_plan_approval_status');
//     $routes->get('plans/plan_pdf', 'PlanController::plan_pdf');
//     $routes->get('plans/plan_policy_action_status', 'PlanController::plan_policy_action_status');
//     $routes->get('plans/planInfo', 'PlanController::planInfo');

//     //Master
//     $routes->get('getDropdownMaster', 'MasterController::getDropdownMaster');
//     $routes->get('getTravelStatusMaster', 'MasterController::getTravelStatusMaster');
//     $routes->get('getcountryMaster', 'MasterController::getcountryMaster');
//     $routes->get('getAirportCodeMaster', 'MasterController::getAirportCodeMaster');
//     $routes->get('getAirlineMaster', 'MasterController::getAirlineMaster');
//     $routes->get('getTrainCodeMaster', 'MasterController::getTrainCodeMaster');
//     $routes->get('getFlightAndTrainClass', 'MasterController::getFlightAndTrainClass');
//     // Costcenter
//     $routes->get('getCostCenterMaster', 'MasterController::getCostCenterMaster');
//     $routes->post('createCostCenter', 'MasterController::createCostCenter');
//     $routes->get('findCostCenter', 'MasterController::findCostCenter');
//     $routes->put('updateCostCenter/(:num)', 'MasterController::updateCostCenter/$1');
//     // Department Master
//     $routes->get('getDepartmentList', 'MasterController::getDepartmentList');
//     $routes->post('createDepartment', 'MasterController::createDepartment');
//     $routes->get('findDepartment', 'MasterController::findDepartment');
//     $routes->put('updateDepartment/(:num)', 'MasterController::updateDepartment/$1');
//     // Purpose of travel Master
//     $routes->get('getPurposeOfTravelList', 'MasterController::getPurposeOfTravelList');
//     $routes->post('createPurposeOfTravel', 'MasterController::createPurposeOfTravel');
//     $routes->get('findPurposeOfTravel', 'MasterController::findPurposeOfTravel');
//     $routes->put('updatePurposeOfTravel/(:num)', 'MasterController::updatePurposeOfTravel/$1');
//     // Forex Master
//     $routes->get('getForexPerdiemList', 'MasterController::getForexPerdiemList');
//     $routes->post('createForexPerdiem', 'MasterController::createForexPerdiem');
//     $routes->get('findForexPerdiem', 'MasterController::findForexPerdiem');
//     $routes->put('updateForexPerdiem/(:num)', 'MasterController::updateForexPerdiem/$1');
//     $routes->post('forex_signature_upload', 'MasterController::forex_signature_upload');
//     $routes->get('getForexSignaturePath', 'MasterController::getForexSignaturePath');
//     // Hotels Master
//     $routes->get('getHotels', 'MasterController::getHotels');
//     $routes->post('createHotels', 'MasterController::createHotels');
//     $routes->get('findHotels', 'MasterController::findHotels');
//     $routes->put('updateHotels/(:num)', 'MasterController::updateHotels/$1');


//     //mail template
//     $routes->get('template', 'EmailTemplateController::index');
//     $routes->put('template/find/(:num)', 'EmailTemplateController::find/$1');
//     $routes->post('template/create', 'EmailTemplateController::create');
//     $routes->put('template/update/(:num)', 'EmailTemplateController::update/$1');
//     $routes->get('getForexTemplate', 'EmailTemplateController::getForexTemplate');

//     $routes->get('getRoles', 'UserController::roleList');


//     $routes->post('advancePurchaseReport', 'ReportsController::advancePurchaseReport');
//     $routes->post('misServicesAnalysis', 'ReportsController::misServicesAnalysis');
//     $routes->post('misAirReport', 'ReportsController::misAirReport');
//     $routes->post('misHotelReport', 'ReportsController::misHotelReport');
//     $routes->post('misForexReport', 'ReportsController::misForexReport');
//     $routes->post('guestHouseReport', 'ReportsController::guestHouseReport');


//  });


// plan review related signed url 
$routes->post('approvePlan', 'PlanController::approvePlan');
$routes->post('rejectPlan', 'PlanController::rejectPlan');
$routes->get('review', 'PlanController::protectedPage', ['filter' => 'signedUrl']);
$routes->get('url', 'PlanController::url');






















