<?php

use CodeIgniter\Router\RouteCollection;

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

$routes->get('app_test', 'MasterController::app_test');

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

    // Agent Login api
    $routes->post('auth/verifyAgentWithMobileNumber', 'AgentAuthController::verifyAgentWithMobileNumber');
    $routes->post('auth/verifyAgentWithEmailId', 'AgentAuthController::verifyAgentWithEmailId');
    $routes->post('auth/getVerifiedAgentData', 'AgentAuthController::getVerifiedAgentData');

    // Staff Login api
    $routes->post('auth/verifyStaffWithMobileNumber', 'StaffAuthController::verifyStaffWithMobileNumber');
    $routes->post('auth/verifyStaffWithEmailId', 'StaffAuthController::verifyStaffWithEmailId');
    $routes->post('auth/getVerifiedStaffData', 'StaffAuthController::getVerifiedStaffData');

});



//api's with token
$routes->group('api', ['filter' => ["jwtAuth:1,2,3,4,agent","appSignature"] ], function ($routes) {

    //logout
    $routes->get('auth/logout', 'StaffAuthController::logout');

    //Master
    $routes->get('master/getRoleMaster', 'MasterController::getRoleMaster');
    $routes->get('master/getInsurancePlanTypeMaster', 'MasterController::getInsurancePlanTypeMaster');
    $routes->get('master/getClaimMaster', 'MasterController::getClaimMaster');
    $routes->get('master/getEndorsementMaster', 'MasterController::getEndorsementMaster');
    $routes->get('master/getInsurersMaster', 'MasterController::getInsurersMaster');
    $routes->post('master/saveInsurer', 'MasterController::saveInsurer');
    $routes->get('master/getStaffMaster', 'MasterController::getStaffMaster');
    $routes->get('master/getAllBrokers', 'MasterController::getAllBrokers');
    $routes->post('master/createBroker', 'MasterController::createBroker');
    $routes->post('master/updateBroker/(:num)', 'MasterController::updateBroker/$1');
    $routes->post('master/updateBrokerStatus/(:num)', 'MasterController::updateBrokerStatus/$1');
    $routes->get('master/getAllPaymentModelist', 'MasterController::getAllPaymentModelist');
    $routes->post('master/createPaymentMode', 'MasterController::createPaymentMode');
    $routes->post('master/updatePaymentMode/(:num)', 'MasterController::updatePaymentMode/$1');
    $routes->post('master/updatePaymentModeStatus/(:num)', 'MasterController::updatePaymentModeStatus/$1');
    $routes->get('master/getAllPOS', 'MasterController::getAllPOS');
    $routes->get('master/getAllEndorsement', 'MasterController::getAllEndorsement');
    $routes->post('master/createEndorsement', 'MasterController::createEndorsement');
    $routes->post('master/updateEndorsement/(:num)', 'MasterController::updateEndorsement/$1');
    $routes->post('master/updateEndorsementStatus/(:num)', 'MasterController::updateEndorsementStatus/$1');
    $routes->get('master/getVehicleTypeMaster', 'MasterController::getVehicleTypeMaster');
    $routes->post('master/createVehicleType', 'MasterController::createVehicleType');
    $routes->post('master/updateVehicleType/(:num)', 'MasterController::updateVehicleType/$1');
    $routes->post('master/updateVehicleTypeStatus/(:num)', 'MasterController::updateVehicleTypeStatus/$1');



    //Agent
    $routes->get('agent/agentList', 'AgentController::agentList');
    $routes->get('agent/agentListForEnquiryCreationDropdown', 'AgentController::agentListForEnquiryCreationDropdown');
    $routes->get('agent/findAgent', 'AgentController::findAgent');
    $routes->get('agent/partnerVehicleTypeList', 'AgentController::partnerVehicleTypeList');
    $routes->post('agent/createAgent', 'AgentController::createAgent');
    $routes->post('agent/updateAgent', 'AgentController::updateAgent');
    $routes->post('agent/updateAgentVehicleRetention', 'AgentController::updateAgentVehicleRetention');
    $routes->post('agent/saveAgentRetentionRatesBulk', 'AgentController::saveAgentRetentionRatesBulk');
    $routes->post('agent/updateDeviceToken', 'AgentController::updateDeviceToken');
    $routes->post('agent/changeAgentStatus', 'AgentController::changeAgentStatus');
    $routes->get('agent/downloadAgentCertificateFile', 'AgentController::downloadAgentCertificateFile');
    $routes->get('agent/agentIncentiveFileList', 'AgentController::agentIncentiveFileList');
    $routes->post('agent/uploadAgentIncentiveFile', 'AgentController::uploadAgentIncentiveFile');
    $routes->get('agent/deleteAgentIncentiveFile', 'AgentController::deleteAgentIncentiveFile');
    $routes->get('agent/downloadAgentIncentiveFile', 'AgentController::downloadAgentIncentiveFile');
    $routes->get('agent/exportRetentionRateExcel', 'ExcelExportController::exportAgentRetentionRateExcel');
    $routes->post('agent/importRetentionRateExcel', 'ExcelExportController::importAgentRetentionRateExcel');

    $routes->get('grid',           'AgentIncentiveController::getGridData');
    $routes->post('grid/upload',   'AgentIncentiveController::uploadGridFile');
    $routes->get('grid/fileList',  'AgentIncentiveController::gridFileList');

    //Staff
    $routes->get('staff/staffList', 'StaffController::staffList');
    $routes->get('staff/staffListForEnquiryAssignDropdown', 'StaffController::staffListForEnquiryAssignDropdown');
    $routes->get('staff/handlerListForStaffCreationDropdown', 'StaffController::handlerListForStaffCreationDropdown');
    $routes->get('staff/findStaff', 'StaffController::findStaff');
    $routes->post('staff/createStaff', 'StaffController::createStaff');
    $routes->post('staff/updateStaff', 'StaffController::updateStaff');
    $routes->post('staff/changeStaffStatus', 'StaffController::changeStaffStatus');
    $routes->get('staff/managerIncentiveFileList', 'StaffController::managerIncentiveFileList');
    $routes->get('staff/downloadManagerIncentiveFile', 'StaffController::downloadManagerIncentiveFile');
    $routes->get('staff/monthlyLoginCount', 'StaffController::monthlyLoginCount');
    $routes->get('staff/staffLoggedDays', 'StaffController::staffLoggedDays');


    //Enquiry
    $routes->get('enquiry/enquiryList', 'EnquiryController::enquiryList');
    $routes->get('enquiry/enquiryQuotePolicyView', 'EnquiryController::enquiryQuotePolicyView');
    $routes->post('enquiry/enquiryAssignUpdate', 'EnquiryController::enquiryAssignUpdate');
    $routes->post('enquiry/createEnquiry', 'EnquiryController::createEnquiry');
    $routes->post('enquiry/updateEnquiry', 'EnquiryController::updateEnquiry');
    $routes->get('enquiry/downloadEnquiryFile', 'EnquiryController::downloadEnquiryFile');
    $routes->post('enquiry/uploadEnquiryFiles', 'EnquiryController::uploadEnquiryFiles');
    $routes->get('enquiry/downloadEnquiryFiles', 'EnquiryController::downloadEnquiryFiles');
    $routes->get('enquiry/deleteEnquiryFile', 'EnquiryController::deleteEnquiryFile');
    $routes->get('enquiry/enquiryFiles', 'EnquiryController::enquiryFiles');
    $routes->get('enquiry/getQuickQuoteEnquiryList', 'EnquiryController::getQuickQuoteEnquiryList');
    $routes->get('enquiry/updateEnquiryInProgress', 'EnquiryController::updateEnquiryInProgress');
    $routes->get('enquiry/updateEnquiryStatus', 'EnquiryController::updateEnquiryStatus');
    $routes->get('enquiry/checkVehicleDuplicate', 'EnquiryController::checkVehicleDuplicate'); // VALIDATION 
    $routes->post('enquiry/setVehicleTypeToEnquiry', 'EnquiryController::setVehicleTypeToEnquiry'); 


    //Proposal
    $routes->get('quotation/quotationList', 'QuotationController::quotationList');
    $routes->get('quotation/findQuotation', 'QuotationController::findQuotation');
    $routes->post('quotation/createQuotation', 'QuotationController::createQuotation');
    $routes->post('quotation/updateQuotation', 'QuotationController::updateQuotation');
    $routes->post('quotation/acceptOrRejectQuotation', 'QuotationController::acceptOrRejectQuotation');
    $routes->get('quotation/downloadAdditionalUploadedFile', 'QuotationController::downloadAdditionalUploadedFile');
    $routes->post('quotation/proceedQuotation', 'QuotationController::proceedQuotation');
    $routes->post('quotation/updateQuoteData', 'QuotationController::updateQuoteData');


    //policy
    $routes->get('policy/policyList', 'PolicyController::policyList');
    $routes->get('policy/findPolicy', 'PolicyController::findPolicy');
    $routes->post('policy/createPolicy', 'PolicyController::createPolicy');
    $routes->post('policy/updatePolicy', 'PolicyController::updatePolicy');
    $routes->post('policy/updatePolicyCommission', 'PolicyController::updatePolicyCommission');
    $routes->get('policy/downloadPolicyFile', 'PolicyController::downloadPolicyFile');
    $routes->post('policy/uploadPolicyFile', 'PolicyController::uploadPolicyFile');
    $routes->get("policy/searchThePolicies", "PolicyController::searchThePolicies");
    $routes->post('policy/calculateCommissionRequest', 'PolicyController::calculateCommissionRequest');
    $routes->get("policy/vehicleTypeMaster", "PolicyController::vehicleTypeMaster");
    $routes->get("policy/fuelTypeMaster", "PolicyController::fuelTypeMaster");
    $routes->get("policy/softdelete", "PolicyController::softdelete");
    $routes->get('policy/downloadPendingCommissionExcel', 'PolicyController::downloadPendingCommissionExcel');
    $routes->get('policy/downloadCommissionUploadSampleExcel', 'PolicyController::downloadCommissionUploadSampleExcel');
    $routes->post('policy/uploadCommissionExcel', 'PolicyController::uploadCommissionExcel');
    $routes->post('policy/payoutInilneEditUpdate', 'PolicyController::payoutInilneEditUpdate');
    $routes->get('policy/commissionPayoutReport', 'PolicyController::commissionPayoutReport');
    $routes->get('policy/commissionPayoutReportExport', 'PolicyController::commissionPayoutReportExport');
    //claims
    $routes->get('claim/claimStatusList', 'ClaimController::claimStatusList');
    $routes->get('claim/ClaimList', 'ClaimController::ClaimList');
    $routes->get('claim/getClaimById', 'ClaimController::getClaimById');
    $routes->get('claim/downloadClaimFile', 'ClaimController::downloadClaimFile');
    $routes->post('claim/createClaim', 'ClaimController::createClaim');
    $routes->post('claim/updateClaim', 'ClaimController::updateClaim');

    //endorsement
    $routes->get('endorsement/endorsementList', 'EndorsementController::endorsementList');
    $routes->post('endorsement/createEndorsement', 'EndorsementController::createEndorsement');
    $routes->post('endorsement/updateEndorsement', 'EndorsementController::updateEndorsement');
    $routes->get('endorsement/downloadEndorsementCompletionFile', 'EndorsementController::downloadEndorsementCompletionFile');
    $routes->post('endorsement/uploadEndorsementFile', 'EndorsementController::uploadEndorsementFile');
    $routes->get('endorsement/deleteEndorsement', 'EndorsementController::deleteEndorsement');
    
    //dashboard
    $routes->get('dashboard/managerDashboard', 'DashboardController::managerDashboard');
    $routes->get('dashboard/handlerDashboard', 'DashboardController::handlerDashboard');
    $routes->get('dashboard/staffDashboard', 'DashboardController::staffDashboard');
    $routes->get('dashboard/agentDashboard', 'DashboardController::agentDashboard');

    $routes->get("dashboard/businessDashboard", "DashboardController::businessDashboard");
    $routes->get("dashboard/partnerDashboard", "DashboardController::partnerDashboard");
    $routes->get("dashboard/productivityDashboard", "DashboardController::productivityDashboard");

    //DASHBOARD Season 1 EXPORT EXCEL (ManagerDashboard - staffLevelPendingSummaryData)
    $routes->get("dashboard/downloadExcelStaffPendingSummary", "ExcelExportController::downloadExcelStaffPendingSummary");
    $routes->get("dashboard/downloadExcelStaffPendingSummaryByID", "ExcelExportController::downloadExcelStaffPendingSummaryByID");

    //DASHBOARD Season 2 EXPORT EXCEL (businessDashboard)
    $routes->get("dashboard/downloadExcelBroker", "ExcelExportController::downloadExcelBroker");
    $routes->get("dashboard/downloadExcelInsurer", "ExcelExportController::downloadExcelInsurer");
    $routes->get("dashboard/downloadExcelProduct", "ExcelExportController::downloadExcelProduct");


    //DASHBOARD Season 3 EXPORT EXCEL (partnerDashboard)
    $routes->get("dashboard/downloadExcelLowPremium", "ExcelExportController::downloadExcelLowPremium"); 
    $routes->get("dashboard/downloadExcelPerformingAgentsByID", "ExcelExportController::downloadExcelPerformingAgentsByID"); 
    $routes->get("dashboard/downloadExcelPerformingAgentsTop50", "ExcelExportController::downloadExcelPerformingAgentsTop50");
    $routes->get("dashboard/downloadExcelWithoutPolicies", "ExcelExportController::downloadExcelWithoutPolicies");

    //DASHBOARD Season 4 EXPORT EXCEL AS ZIP (partnerDashboard - 3Excel in Zip Folder)
    $routes->get("dashboard/downloadExcelAsZIP", "ExcelExportController::downloadExcelAsZIP");

    //DASHBOARD Season 5 EXPORT EXCEL (productivityDashboard)
    $routes->get("dashboard/downloadExcelStaffAndProduct", "ExcelExportController::downloadExcelStaffAndProduct");
    
    $routes->get('reports/endorsement-excel', 'ExcelExportController::downloadExcelEndorsement');

 
    //  DASHBOARD Season 6  —  Partner Portal
    
    // GET /partner/{id}/details
    $routes->get('partner/(:num)/details', 'DashboardController::partnerDetails/$1');
    
    // GET /partner/{id}/policies
    $routes->get('partner/(:num)/policies', 'DashboardController::partnerPolicies/$1');
    
    // GET /partner/{id}/renewals?days=N
    $routes->get('partner/(:num)/renewals', 'DashboardController::partnerRenewals/$1');
    
    // GET /partner/{id}/earnings
    $routes->get('partner/(:num)/earnings', 'DashboardController::partnerEarnings/$1');
 
    //  DASHBOARD Season 7  —  Partner Portal
    $routes->get('grid/download',      'ExcelExportController::downloadExcelGrid');
     

    //invoice
    $routes->get('invoice/list', 'InvoiceController::invoiceList');
    $routes->get('invoice/details', 'InvoiceController::findInvoiceWithItems');
    $routes->get('invoice/view', 'InvoiceController::invoiceView');
    $routes->post('invoice/create-or-update', 'InvoiceController::createOrUpdateInvoice');
    $routes->get('invoice/utrDetails', 'InvoiceController::utrDetails');
    $routes->post('invoice/add-payment', 'InvoiceController::addInvoicePayment'); // tempo 
    $routes->post('invoice/updateUtrDetails', 'InvoiceController::updateUtrDetails');
    $routes->get('invoice/add-payment-history', 'InvoiceController::addPaymentHistory'); // tempo
    $routes->post('invoice/add-payment-history', 'InvoiceController::addPaymentHistory'); // tempo
    $routes->get('invoice/listUtrDetails', 'InvoiceController::listUtrDetails');
    $routes->post('invoice/listUtrDetails', 'InvoiceController::listUtrDetails');
    $routes->get('invoice/delete', 'InvoiceController::deleteInvoice');
    $routes->post('invoice/commission-rate-list', 'InvoiceController::getCommissionRateList');
    $routes->get('invoice/getAgentUnusedCommissionList', 'InvoiceController::getAgentUnusedCommissionList');
    $routes->post('invoice/bulk-upload-commission', 'InvoiceController::bulkUploadCommission');
    $routes->post('invoice/bulk-upload-commission/proceed', 'InvoiceController::bulkUploadCommissionProceed');
    $routes->post('invoice/bulk-upload-commission', 'InvoiceController::bulkUploadCommission');
    $routes->post('invoice/bulk-upload-commission/proceed', 'InvoiceController::bulkUploadCommissionProceed');


    // SALES EXECUTIVE
    $routes->get('salesExecutive/executiveList', 'SalesExecutive::salesExecutiveList');
    $routes->get('salesExecutive/findExecutive', 'SalesExecutive::findSalesExecutive');
    $routes->post('salesExecutive/createExecutive', 'SalesExecutive::createSalesExecutive');
    $routes->post('salesExecutive/updateExecutive', 'SalesExecutive::updateSalesExecutivedetails');
    $routes->post('salesExecutive/changeExecutiveStatus', 'SalesExecutive::changeSalesExecutiveStatus');

    //report
    $routes->get('reports/policy-excel', 'PolicyReportController::downloadExcel');

    //audit
    $routes->get('audit/history', 'MasterController::getHistory');
    

});


     
 $routes->get("api/policy/PolicyFilePath", "PolicyController::PolicyFilePath");
 $routes->get("api/endorsement/EndorsementFilePath", "EndorsementController::EndorsementFilePath");

  $routes->group('test', [ ], function ($routes) {

    $routes->get("policyCommissionCalculationAndGeminiPolicyRead", "PolicyController::policyCommissionCalculationAndGeminiPolicyRead");

  });

$routes->cli('cli/processjob', 'JobWorker::processJob');
$routes->cli('cli/processjobs', 'JobWorker::processJobs');
$routes->get("processjob", "JobWorker::processJob");




 $routes->get('checkPolicyDoc', 'PolicyController::readFile');
 $routes->get('calculateCommission', 'PolicyController::calculateCommission');
 $routes->get('testPolicy', 'QuotationController::testPolicy');


    
