<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\SupervisingPhysicianController;
use App\Http\Controllers\ManagementStatsController;
use App\Http\Controllers\VideoTestController;
use App\Http\Controllers\SystemFileController;
use App\Http\Controllers\MessageController;
use App\Http\Controllers\CompanyClientController;
use App\Http\Controllers\CustomerController;
use App\Http\Controllers\ClientProAccessController;
use App\Http\Controllers\RdController;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/


/*
 * if no pro performer, then redirect to /login2
 * [Cell Number] [Password] field -> proLogInWithPassword -> /pro/dashboard
 * -> they are authenticated in... see the home dashboard... logout button to -> /login
 */

Route::get('login', 'LoginController@showLoginForm')->name('login');
Route::post('login', 'LoginController@login');
Route::get('logout', 'LoginController@logout');

Route::get('request_password_reset', 'LoginController@showRequestPasswordReset')->name('request_password_reset');
Route::post('request_password_reset', 'LoginController@processRequestPasswordReset')->name('process_request_password_reset');
Route::get('self_reset_password', 'LoginController@showSelfResetPassword')->name('self_reset_password');
Route::post('self_reset_password', 'LoginController@processSelfResetPassword')->name('process_self_reset_password');

Route::get('/pro_log_in_with_session_key/{sessionKey}/{appAccessUID?}', 'LoginController@loginWithSessionKey')->name('login_with_session_key');

Route::post('logout', 'LoginController@logout')->name('logout');

Route::post('/confirm_sms_auth_token', 'HomeController@postConfirmSmsAuthToken')->name('post-confirm_sms_auth_token');
Route::post('/resend_sms_auth_token', 'HomeController@resendSmsAuthToken')->name('post-resend_sms_auth_token');
Route::post('/set_password', 'HomeController@postSetPassword')->name('post-set_password');
Route::post('/set_security_questions', 'HomeController@postSetSecurityQuestions')->name('post-set_security_questions');

Route::get("/guest/section/{accessToken}", 'GuestController@section')->name('guest_section_access');
Route::get("/guest/handout/{handoutClientUid}", 'GuestController@handout')->name('guest_handout_access');
Route::get("/appointment-confirmation/{appointmentUid}", 'GuestController@appointmentConfirmation')->name('appointment_confirmation');
Route::post("/process-appointment-confirmation", 'GuestController@processAppointmentConfirmation')->name('process-appointment_confirmation');

Route::get('/ticket-download-as-pdf/{ticket}', 'TicketController@downloadAsPdf')->name('ticket-download-as-pdf');
Route::get('/prescription-download-as-pdf/{prescription}', 'PatientController@downloadPrescriptionAsPdf')->name('prescription-download-as-pdf');
Route::any('/prescription-transmit/{prescription}', 'PatientController@transmitPrescription')->name('prescription-transmit');
Route::get('/get-ticket-faxes/{ticket}', 'TicketController@getTicketFaxes')->name('get-ticket-faxes');

Route::middleware('pro.auth')->group(function () {

    //complete authentication

    Route::get('/confirm_sms_auth_token', 'HomeController@confirmSmsAuthToken')->name('confirm_sms_auth_token');

    Route::get('/set_password', 'HomeController@setPassword')->name('set_password');

    Route::get('/set_security_questions', 'HomeController@setSecurityQuestions')->name('set_security_questions');

    Route::get('/blank', 'HomeController@blank')->name('blank');

    Route::get('/', 'HomeController@dashboard')->name('dashboard');
    Route::get('/pro-dashboard-measurements-tab/{page?}', 'HomeController@dashboardMeasurementsTab')->name('dashboard-measurements-tab');

    Route::get('/new-patient', 'HomeController@newPatient')->name('new-patient');
    Route::get('/new-non-mcn-patient', 'HomeController@newNonMcnPatient')->name('new-non-mcn-patient');

    Route::get('/unmapped-sms/{filter?}', 'HomeController@unmappedSMS')->name('unmapped-sms');

    Route::get('/can-access-patient/{uid}', 'HomeController@canAccessPatient')->name('can-access-patient');

    Route::name('mcp.')->prefix('m')->middleware('pro.auth.mcp')->group(function () {

        Route::get('dashboard', 'HomeController@dashboard_MCP')->name('dashboard');

        Route::get('patients', 'McpController@patients')->name('patients');
        Route::get('notes', 'McpController@notes')->name('notes');
        Route::get('appointments', 'McpController@appointments')->name('appointments');
        Route::get('bills', 'McpController@bills')->name('bills');
        Route::get('erx-and-orders', 'McpController@erx_and_orders')->name('erx_and_orders');
        Route::get('reports', 'McpController@reports')->name('reports');
        Route::get('supply-orders', 'McpController@supply_orders')->name('supply_orders');
        Route::get('client-messages', 'McpController@client_messages')->name('client_messages');
        Route::get('clients-bdt-devices', 'McpController@clients_bdt_devices')->name('clients_bdt_devices');
        Route::get('patients-accounts-invites', 'McpController@patients_accounts_invites')->name('patients_accounts_invites');
        Route::get('memos', 'McpController@memos')->name('memos');


        Route::get('new-patients-awaiting-visit', 'McpController@new_patients_awaiting_visit')->name('new_patients_awaiting_visit');
        Route::get('notes-pending-signature', 'McpController@notes_pending_signature')->name('notes_pending_signature');
        Route::get('notes-pending-summary-suggestion', 'McpController@notes_pending_summary_suggestion')->name('notes_pending_summary_suggestion');
        Route::get('notes-rejected-summary-suggestion', 'McpController@notes_rejected_summary_suggestion')->name('notes_rejected_summary_suggestion');
        Route::get('notes-pending-billing', 'McpController@notes_pending_billing')->name('notes_pending_billing');
        Route::get('bills-pending-signature', 'McpController@bills_pending_signature')->name('bills_pending_signature');
        Route::get('reports-pending-signature', 'McpController@reports_pending_signature')->name('reports_pending_signature');
        Route::get('patients-without-appointments', 'McpController@patients_without_appointments')->name('patients_without_appointments');
        Route::get('patients-overdue-for-visit', 'McpController@patients_overdue_for_visit')->name('patients_overdue_for_visit');
        Route::get('cancelled-appointments-pending-review', 'McpController@cancelled_appointments_pending_review')->name('cancelled_appointments_pending_review');
        Route::get('cancelled-bills-pending-review', 'McpController@cancelled_bills_pending_review')->name('cancelled_bills_pending_review');
        Route::get('cancelled-supply-orders-pending-review', 'McpController@cancelled_supply_orders_pending_review')->name('cancelled_supply_orders_pending_review');
        Route::get('erx-and-orders-pending-signature', 'McpController@erx_and_orders_pending_signature')->name('erx_and_orders_pending_signature');
        Route::get('supply-orders-pending-signature', 'McpController@supply_orders_pending_signature')->name('supply_orders_pending_signature');
        Route::get('supply-orders-awaiting-shipment', 'McpController@supply_orders_awaiting_shipment')->name('supply_orders_awaiting_shipment');
        Route::get('unsigned-incoming-reports', 'McpController@unsigned_incoming_reports')->name('unsigned_incoming_reports');
        Route::get('patients-awaiting-rpm-interaction', 'McpController@patients_awaiting_rpm_interaction')->name('patients_awaiting_rpm_interaction');

        Route::get('measurements-pending-stamping', 'McpController@measurements_pending_stamping')->name('measurements_pending_stamping');
        Route::get('measurements-pending-stamping-in-care-month', 'McpController@measurements_pending_stamping_in_care_month')->name('measurements_pending_stamping_in_care_month');

        Route::get('measurements-mass-stamping', 'McpController@measurements_mass_stamping')->name('measurements_mass_stamping');

    });

    Route::name('hcp.')->prefix('h')->group(function () {

        Route::get('dashboard', 'HomeController@dashboard_HCP')->name('dashboard');

        //TODO HCP CONTROLLER
//        Route::get('patients', 'McpController@patients')->name('patients');
//        Route::get('notes', 'McpController@notes')->name('notes');
//        Route::get('appointments', 'McpController@appointments')->name('appointments');
//        Route::get('bills', 'McpController@bills')->name('bills');
//        Route::get('erx-and-orders', 'McpController@erx_and_orders')->name('erx_and_orders');
//        Route::get('reports', 'McpController@reports')->name('reports');
//        Route::get('supply-orders', 'McpController@supply_orders')->name('supply_orders');
//        Route::get('client-messages', 'McpController@client_messages')->name('client_messages');
//        Route::get('clients-bdt-devices', 'McpController@clients_bdt_devices')->name('clients_bdt_devices');
//        Route::get('patients-accounts-invites', 'McpController@patients_accounts_invites')->name('patients_accounts_invites');
//        Route::get('memos', 'McpController@memos')->name('memos');
//
//
//        Route::get('new-patients-awaiting-visit', 'McpController@new_patients_awaiting_visit')->name('new_patients_awaiting_visit');
//        Route::get('notes-pending-signature', 'McpController@notes_pending_signature')->name('notes_pending_signature');
//        Route::get('notes-pending-billing', 'McpController@notes_pending_billing')->name('notes_pending_billing');
//        Route::get('bills-pending-signature', 'McpController@bills_pending_signature')->name('bills_pending_signature');
//        Route::get('reports-pending-signature', 'McpController@reports_pending_signature')->name('reports_pending_signature');
//        Route::get('patients-without-appointments', 'McpController@patients_without_appointments')->name('patients_without_appointments');
//        Route::get('patients-overdue-for-visit', 'McpController@patients_overdue_for_visit')->name('patients_overdue_for_visit');
//        Route::get('cancelled-appointments-pending-review', 'McpController@cancelled_appointments_pending_review')->name('cancelled_appointments_pending_review');
//        Route::get('cancelled-bills-pending-review', 'McpController@cancelled_bills_pending_review')->name('cancelled_bills_pending_review');
//        Route::get('cancelled-supply-orders-pending-review', 'McpController@cancelled_supply_orders_pending_review')->name('cancelled_supply_orders_pending_review');
//        Route::get('erx-and-orders-pending-signature', 'McpController@erx_and_orders_pending_signature')->name('erx_and_orders_pending_signature');
//        Route::get('supply-orders-pending-signature', 'McpController@supply_orders_pending_signature')->name('supply_orders_pending_signature');
//        Route::get('supply-orders-awaiting-shipment', 'McpController@supply_orders_awaiting_shipment')->name('supply_orders_awaiting_shipment');
//
//        Route::get('measurements-pending-stamping', 'McpController@measurements_pending_stamping')->name('measurements_pending_stamping');

    });

    Route::middleware('pro.auth.na')->group(function(){
        Route::name('dna.')->prefix('n')->group(function () {

            Route::get('dashboard', 'HomeController@dashboard_DNA')->name('dashboard');

            Route::get('patients', 'DnaController@patients')->name('patients');
            Route::get('encounters', 'DnaController@encounters')->name('encounters');
            Route::get('notes', 'DnaController@notes')->name('notes');
            Route::get('appointments', 'DnaController@appointments')->name('appointments');
            Route::get('care-months', 'DnaController@careMonths')->name('careMonths');
            Route::get('financial-transactions', 'DnaController@financialTransactions')->name('financialTransactions');
            Route::get('my-bills', 'DnaController@myBills')->name('myBills');
            Route::get('my-clinical-teams', 'DnaController@myClinicalTeams')->name('myClinicalTeams');
            Route::get('my-clinical-teams', 'DnaController@myClinicalTeams')->name('myClinicalTeams');

            Route::name('my-clinical-teams.view.')->prefix('my-clinical-teams/view/{team}')->group(function () {
                Route::get('dashboard', 'DnaController@teamDashboard')->name('team-dashboard');
            });

            Route::get('bills', 'DnaController@bills')->name('bills');
            Route::get('erx-and-orders', 'DnaController@erx_and_orders')->name('erx_and_orders');
            Route::get('reports', 'DnaController@reports')->name('reports');
            Route::get('supply-orders', 'DnaController@supply_orders')->name('supply_orders');

            Route::get('new_patients_awaiting_visit', 'DnaController@new_patients_awaiting_visit')->name('new_patients_awaiting_visit');
            Route::get('notes_pending_signature', 'DnaController@notes_pending_signature')->name('notes_pending_signature');
            Route::get('notes_pending_billing', 'DnaController@notes_pending_billing')->name('notes_pending_billing');
            Route::get('reports_pending_signature', 'DnaController@reports_pending_signature')->name('reports_pending_signature');
            Route::get('patients_without_appointments', 'DnaController@patients_without_appointments')->name('patients_without_appointments');
            Route::get('patients_overdue_for_visit', 'DnaController@patients_overdue_for_visit')->name('patients_overdue_for_visit');
            Route::get('cancelled_appointments_pending_review', 'DnaController@cancelled_appointments_pending_review')->name('cancelled_appointments_pending_review');
            Route::get('cancelled_bills_pending_review', 'DnaController@cancelled_bills_pending_review')->name('cancelled_bills_pending_review');
            Route::get('cancelled_supply_orders_pending_review', 'DnaController@cancelled_supply_orders_pending_review')->name('cancelled_supply_orders_pending_review');
            Route::get('erx_and_orders_pending_signature', 'DnaController@erx_and_orders_pending_signature')->name('erx_and_orders_pending_signature');
            Route::get('supply_orders_pending_signature', 'DnaController@supply_orders_pending_signature')->name('supply_orders_pending_signature');

            //from the new spec
            Route::get('my-patients', 'DnaController@myPatients')->name('my-patients');
            Route::get('patients_awaiting_mcp_visit', 'DnaController@patientsAwaitingMcpVisit')->name('patients_awaiting_mcp_visit');
            Route::get('patients_without_appointment', 'DnaController@patientsWithoutAppointment')->name('patients_without_appointment');
            Route::get('encounters_pending_my_review', 'DnaController@encountersPendingMyReview')->name('encounters_pending_my_review');
            Route::get('encounters_in_progress', 'DnaController@encountersInProgress')->name('encounters_in_progress');
            Route::get('appointments_pending_confirmation', 'DnaController@appointmentsPendingConfirmation')->name('appointments_pending_confirmation');
            Route::get('cancelled_appointments_pending_ack', 'DnaController@cancelledAppointmentsPendingAck')->name('cancelled_appointments_pending_ack');
            Route::get('reports_pending_ack', 'DnaController@reportsPendingAck')->name('reports_pending_ack');
            Route::get('supply_orders_pending_my_ack', 'DnaController@supplyOrdersPendingMyAck')->name('supply_orders_pending_my_ack');
            Route::get('supply_orders_pending_hcp_approval', 'DnaController@supplyOrdersPendingHcpApproval')->name('supply_orders_pending_hcp_approval');

        });
    });


    Route::name('ps.')->prefix('ps')->group(function () {
        Route::get('dashboard', [SupervisingPhysicianController::class, 'dashboard'])->name('dashboard');
        Route::get('client-review-requests', [SupervisingPhysicianController::class, 'clientReviewRequests'])->name('client-review-requests');


    });

    Route::name('rd.')->prefix('rd')->group(function () {
        Route::get('dashboard', [RdController::class, 'dashboard'])->name('dashboard');
        Route::get('dashboard-patients', [RdController::class, 'dashboardPatients'])->name('dashboard-patients');
        Route::get('client-review-requests', [RdController::class, 'clientReviewRequests'])->name('client-review-requests');
        Route::get('patients', [RdController::class, 'patients'])->name('patients');
        Route::get('patients_awaiting_mcp_visit', [RdController::class, 'patientsAwaitingMcpVisit'])->name('patients_awaiting_mcp_visit');
        Route::get('patients_without_appointment', [RdController::class, 'patientsWithoutAppointment'])->name('patients_without_appointment');
        Route::get('encounters_pending_my_review', [RdController::class, 'encountersPendingMyReview'])->name('encounters_pending_my_review');
        Route::get('encounters_in_progress', [RdController::class, 'encountersInProgress'])->name('encounters_in_progress');
        Route::get('appointments_pending_confirmation', [RdController::class, 'appointmentsPendingConfirmation'])->name('appointments_pending_confirmation');
        Route::get('cancelled_appointments_pending_ack', [RdController::class, 'cancelledAppointmentsPendingAck'])->name('cancelled_appointments_pending_ack');
        Route::get('reports_pending_ack', [RdController::class, 'reportsPendingAck'])->name('reports_pending_ack');
        Route::get('supply_orders_pending_my_ack', [RdController::class, 'supplyOrdersPendingMyAck'])->name('supply_orders_pending_my_ack');
        Route::get('supply_orders_pending_hcp_approval', [RdController::class, 'supplyOrdersPendingHcpApproval'])->name('supply_orders_pending_hcp_approval');
        Route::get('appointments', [RdController::class, 'appointments'])->name('appointments');
        Route::get('client-ccm-rm-status', [RdController::class, 'clientCcmRmStatus'])->name('client-ccm-rm-status');
        Route::get('rpm-matrix', [RdController::class, 'rpmMatrix'])->name('rpmMatrix');
        Route::get('notes', [RdController::class, 'notes'])->name('notes');
        Route::get('memos', [RdController::class, 'memos'])->name('memos');
        Route::get('bills', [RdController::class, 'bills'])->name('bills');
        Route::get('erx_and_orders', [RdController::class, 'erxAndOrders'])->name('erx_and_orders');
        Route::get('reports', [RdController::class, 'reports'])->name('reports');
        Route::get('supply_orders', [RdController::class, 'supplyOrders'])->name('supply_orders');
        Route::get('client_messages', [RdController::class, 'clientMessages'])->name('client_messages');
        Route::get('patients_accounts_invites', [RdController::class, 'patientsAccountsInvites'])->name('patients_accounts_invites');
        Route::get('clients_bdt_devices', [RdController::class, 'clientsBdtDevices'])->name('clients_bdt_devices');
        
        

    });

    Route::name('ca.')->prefix('ca')->group(function () {
        Route::get('dashboard', [ClientProAccessController::class, 'dashboard'])->name('dashboard');
        Route::get('client-review-requests', [ClientProAccessController::class, 'clientReviewRequests'])->name('client-review-requests');
        Route::get('patients', [ClientProAccessController::class, 'patients'])->name('patients');


    });



    //Route::get('test-gsheet', 'GsheetController@testGsheet');

    Route::name('admin.')->prefix('a')->middleware('pro.auth.admin')->group(function () {
        // TODO

        Route::get('dashboard', 'HomeController@dashboard_ADMIN')->name('dashboard');

        Route::get('patients', 'AdminController@patients')->name('patients');
        Route::get('part_b_patients', 'AdminController@partBPatients')->name('part_b_patients');
        Route::get('bdt_devices', 'AdminController@bdtDevices')->name('bdt_devices');
        Route::get('notes', 'AdminController@notes')->name('notes');
        Route::get('notes-pending-summary-suggestion', 'AdminController@notes_pending_summary_suggestion')->name('notes_pending_summary_suggestion');
        Route::get('notes-rejected-summary-suggestion', 'AdminController@notes_rejected_summary_suggestion')->name('notes_rejected_summary_suggestion');
        Route::get('appointments', 'AdminController@appointments')->name('appointments');
        Route::get('bills', 'AdminController@bills')->name('bills');
        Route::get('erx-and-orders', 'AdminController@erx_and_orders')->name('erx_and_orders');
        Route::get('reports', 'AdminController@reports')->name('reports');
        Route::get('supply-orders', 'AdminController@supply_orders')->name('supply_orders');
        Route::get('get-create-new-patient-script-template', 'AdminController@getCreateNewPatientScriptTemplate')->name('getCreateNewPatientScriptTemplate');
        Route::get('patients-missing-defult-settings', 'AdminController@patientsMissingDefasultSettings')->name('patientsMissingDefasultSettings');
        Route::get('points', 'AdminController@points')->name('points');
    });
    Route::middleware('pro.auth.admin')->group(function () {
        Route::get('mgmt-stats', [ManagementStatsController::class, 'index'])->name('management-stats');
        Route::get('messages', 'AdminController@messages')->name('messages');
    });

    Route::name('invoice-center.')->prefix('invoice-center')->group(function () {
        Route::middleware('pro.auth.admin')->group(function () {
            Route::get('companies', 'InvoiceController@companies')->name('companies');
            Route::get('customers', 'InvoiceController@customers')->name('customers');
            Route::get('gift-cards', 'InvoiceController@giftCards')->name('giftCards');
            Route::get('invoices', 'InvoiceController@invoices')->name('invoices');
            Route::get('customer-transactions', 'InvoiceController@customerTransactions')->name('customerTransactions');
            Route::get('invoice-transactions', 'InvoiceController@invoiceTransactions')->name('invoiceTransactions');
        });
    });

    Route::name('practice-management.')->prefix('practice-management')->group(function () {

        // rpm manager (new)
        Route::get('rpm-manager', 'PracticeManagementController@rpmManager')->name('rpm-manager');
        Route::get('rpm-manager-row/{uid}', 'PracticeManagementController@rpmManagerRow')->name('rpm-manager-row');


        Route::get('my-flyers', 'PracticeManagementController@myFlyers')->name('my-flyers');
        Route::get('notes-pending-physician-supervisor-stamping', 'PracticeManagementController@notesPendingPhysicianSupervisorStamping')->name('notes-pending-physician-supervisor-stamping');

        // new
        Route::get('clients-without-default-company-pro-payer', 'PracticeManagementController@clientsWithoutDefaultCompanyProPayer')->name('clients-without-default-company-pro-payer');
        Route::get('notes-without-hcp-company-pro-payer', 'PracticeManagementController@notesWithoutHcpCompanyProPayer')->name('notes-without-hcp-company-pro-payer');
        Route::get('note-hcp-bills-without-company-pro', 'PracticeManagementController@noteHcpBillsWithoutCompanyPro')->name('note-hcp-bills-without-company-pro');
        Route::get('rpm-mcp-bills-without-company-pro', 'PracticeManagementController@rpmMcpBillsWithoutCompanyPro')->name('rpm-mcp-bills-without-company-pro');
        Route::get('rpm-rmm-bills-without-company-pro', 'PracticeManagementController@rpmRmmBillsWithoutCompanyPro')->name('rpm-rmm-bills-without-company-pro');

        Route::get('rpm-matrix', 'PracticeManagementController@rpmMatrix')->name('rpmMatrix');
        Route::get('client-review-requests', 'PracticeManagementController@clientReviewRequests')->name('client-review-requests');

        // rpm work matrix - latest patient with unstamped measurements
        Route::get('rpm-work-matrix', 'PracticeManagementController@rpm_work_matrix')->name('rpm_work_matrix');

        // notes resolution
        Route::get('notes-resolution-center', 'PracticeManagementController@notesResolutionCenter')->name('notes-resolution-center');
        Route::get('notes-resolution-center-v2', 'PracticeManagementController@notesResolutionCenterV2')->name('notes-resolution-center-v2');

        Route::get('coverages', 'PracticeManagementController@coverages')->name('coverages');

        Route::get('rates/{selectedProUid?}', 'PracticeManagementController@rates')->name('rates');
        Route::get('dashboard', 'PracticeManagementController@dashboard')->name('dashboard');
        Route::get('previous-bills', 'PracticeManagementController@previousBills')->name('previousBills');
        Route::get('financial-transactions', 'PracticeManagementController@financialTransactions')->name('financialTransactions');
        Route::get('bills-under-processing', 'PracticeManagementController@billsUnderProcessing')->name('bills-under-processing');
        Route::get('pending-bills-to-sign', 'PracticeManagementController@pendingBillsToSign')->name('pendingBillsToSign');
        Route::get('hr', 'PracticeManagementController@hr')->name('hr');
        Route::get('direct-deposit-settings', 'PracticeManagementController@directDepositSettings')->name('directDepositSettings');
        Route::get('w9', 'PracticeManagementController@w9')->name('w9');
        Route::get('contract', 'PracticeManagementController@contract')->name('contract');
        Route::get('notes/{filter?}', 'PracticeManagementController@notes')->name('notes');
        Route::get('all-notes', 'PracticeManagementController@allNotes')->name('allNotes');
        Route::get('dna-notes-pending-mcp-sign', 'PracticeManagementController@dnaNotesPendingMcpSign')->name('dna-notes-pending-mcp-sign');
        Route::get('na-billable-signed-notes/{filter?}', 'PracticeManagementController@naBillableSignedNotes')->name('na-billable-signed-notes');
        Route::get('bills/{filter?}', 'PracticeManagementController@bills')->name('bills');
        Route::get('rm-bills-to-sign', 'PracticeManagementController@rmBillsToSign')->name('rm-bills-to-sign');
        Route::get('unacknowledged-cancelled-bills', 'PracticeManagementController@unacknowledgedCancelledBills')->name('unacknowledged-cancelled-bills');
        Route::get('my-tickets/{filter?}', 'PracticeManagementController@myTickets')->name('myTickets');
        Route::get('my-text-shortcuts', 'PracticeManagementController@myTextShortcuts')->name('myTextShortcuts');
        Route::get('my-favorites/{filter?}', 'PracticeManagementController@myFavorites')->name('myFavorites');
        Route::get('patients-without-coverage/{filter?}', 'PracticeManagementController@patientsWithoutCoverage')->name('patients-without-coverage');
        Route::get('pro-availability/{proUid?}', 'PracticeManagementController@proAvailability')->name('proAvailability');
        Route::get('calendar/{proUid?}', 'PracticeManagementController@calendar')->name('proCalendar');

        Route::get('billing-manager/{proUid?}', 'PracticeManagementController@billingManager')->name('billingManager');

        Route::get('cellular-device-manager/{proUid?}', 'PracticeManagementController@cellularDeviceManager')->name('cellularDeviceManager');

        Route::get('rm-launch-and-clean', 'PracticeManagementController@rmLaunchAndClean')->name('rm-launch-and-clean');
        Route::get('process-claims', 'PracticeManagementController@processClaims')->name('process-claims');
        Route::get('process-notes', 'PracticeManagementController@processNotes')->name('process-notes');
        Route::get('notes-processing-center', 'PracticeManagementController@notesProcessingCenter')->name('notes-processing-center');
        Route::get('picked-notes', 'PracticeManagementController@pickedNotes')->name('picked-notes');
        Route::get('bad-notes', 'PracticeManagementController@badNotes')->name('bad-notes');
        Route::get('done-notes', 'PracticeManagementController@doneNotes')->name('done-notes');
        Route::get('get-next-note/{mode}', 'PracticeManagementController@getNextNote')->name('get-next-note');

        Route::get('my-teams', 'PracticeManagementController@myTeams')->name('my-teams');
        Route::get('patients-accounts-invites', 'PracticeManagementController@patientsAccountsInvites')->name('patientsAccountsInvites');
        Route::get('clients-bdt-devices', 'PracticeManagementController@clientsBdtDevices')->name('clientsBdtDevices');
        Route::get('memos', 'PracticeManagementController@memos')->name('memos');
        Route::get('client-ccm-rm-status', 'PracticeManagementController@clientCcmRmStatus')->name('client-ccm-rm-status');

        Route::get('hcp-note-activity', 'PracticeManagementController@hcpNoteActivity')->name('hcp-note-activity');

        Route::middleware('pro.auth.admin')->group(function () {

            Route::get('incoming-reports/{filter?}', 'PracticeManagementController@incomingReports')->name('incoming-reports');

            Route::get('segment-templates', 'PracticeManagementController@segmentTemplates')->name('segmentTemplates');
            Route::get('visit-templates', 'PracticeManagementController@visitTemplates')->name('visitTemplates');
            Route::get('visit-template/{visitTemplate}', 'PracticeManagementController@visitTemplate')->name('visitTemplate');
            Route::get('visit-template-access/{visitTemplate}', 'PracticeManagementController@visitTemplateAccess')->name('visitTemplateAccess');

            Route::get('rm-action-report', 'PracticeManagementController@rmActionReport')->name('rmActionReport');

		    Route::get('remote-monitoring-report', 'PracticeManagementController@remoteMonitoringReport')->name('remoteMonitoringReport');
            Route::get('daily-treatment-services', 'PracticeManagementController@dailyTreatmentServices')->name('daily-treatment-services');
            Route::get('client-pro-changes', 'PracticeManagementController@clientProChanges')->name('client-pro-changes');

            // BILLING REPORT
            Route::get('billing-report', 'PracticeManagementController@billingReport')->name('billing-report');

            Route::get('patient-claim-summary/{proUid?}', 'PracticeManagementController@patientClaimSummary')->name('patientClaimSummary');

            Route::get('cellular-measurements', 'PracticeManagementController@cellularMeasurements')->name('cellularMeasurements');

            Route::get('processing-bill-matrix/{proUid?}/{filter?}', 'PracticeManagementController@processingBillMatrix')->name('processingBillMatrix');

            Route::get('processing-bill-matrix2/{proUid?}/{filter?}', 'PracticeManagementController@processingBillMatrix2')->name('processingBillMatrix2');

            Route::get('pro-financials/{proUid?}', 'PracticeManagementController@proFinancials')->name('pro-financials');

            //Route::get('hcp-bill-matrix/{proUid?}', 'PracticeManagementController@hcpBillMatrix')->name('hcpBillMatrix');
            Route::get('bill-matrix/{proUid?}', 'PracticeManagementController@billMatrix')->name('billMatrix');

            Route::get('tickets', 'PracticeManagementController@tickets')->name('tickets');
            Route::get('medicare-partb-claims', 'PracticeManagementController@medicarePartBClaims')->name('medicarePartBClaims');
            Route::get('claims-download', 'PracticeManagementController@downloadClaims')->name('download-claims');

            Route::get('treatment-service-util', 'PracticeManagementController@treatmentServiceUtil')->name('treatmentServiceUtil');

            Route::get('claims', 'PracticeManagementController@claims')->name('claims');

            // old supply-orders & shipments matrices
            // Route::get('supply-orders', 'PracticeManagementController@supplyOrders')->name('supply-orders');
            // Route::get('shipments', 'PracticeManagementController@shipments')->name('shipments');

            // v2 supply-orders & shipments management (wh)

            Route::get('supply-orders', 'PracticeManagementController@supplyOrders')->name('supply-orders');
            Route::get('supply-orders/ready-to-ship', 'PracticeManagementController@supplyOrdersReadyToShip')->name('supply-orders-ready-to-ship');
            Route::get('supply-orders/shipment-underway', 'PracticeManagementController@supplyOrdersShipmentUnderway')->name('supply-orders-shipment-underway');
            Route::get('supply-orders/hanging', 'PracticeManagementController@supplyOrdersHanging')->name('supply-orders-hanging');
            Route::get('shipments', 'PracticeManagementController@shipments')->name('shipments');
            Route::get('shipments/ready-to-print', 'PracticeManagementController@shipmentsReadyToPrint')->name('shipments-ready-to-print');
            Route::get('shipments/waiting-for-picker', 'PracticeManagementController@shipmentsShipmentUnderway')->name('shipments-waiting-for-picker');
            Route::get('shipments/view/{shipment}', 'PracticeManagementController@shipment')->name('shipment');
            Route::get('shipments-multi-print/{ids?}', 'PracticeManagementController@shipmentsMultiPrint')->name('shipments-multi-print');
            Route::get('packs-multi-print', 'PracticeManagementController@packsMultiPrint')->name('packs-multi-print');
            Route::get('packs-multi-pdf/{ids?}', 'PracticeManagementController@packsMultiPDF')->name('packs-multi-pdf');
            Route::get('handouts', 'PracticeManagementController@handouts')->name('handouts');
            Route::get('generic-bills', 'PracticeManagementController@genericBills')->name('generic-bills');
            Route::get('mc-code-checks', 'PracticeManagementController@mcCodeChecks')->name('mc-code-checks');

            Route::get('remote-monitoring-admin', 'PracticeManagementController@remoteMonitoringAdmin')->name('remote-monitoring-admin');
            Route::get('remote-monitoring-admin-count', 'PracticeManagementController@remoteMonitoringAdminCount')->name('remote-monitoring-admin-count');

            Route::get('rpm-admin', 'PracticeManagementController@rpmMatrixForAdmin')->name('rpm-matrix-admin');

            Route::get('claims-report', 'PracticeManagementController@claimsReport')->name('claims-report');

            Route::get('problems-report', 'PracticeManagementController@problemsReport')->name('problems-report');
        });



        Route::get('supply-orders/cancelled-but-unacknowledged', 'PracticeManagementController@supplyOrdersCancelledButUnacknowledged')->name('supply-orders-cancelled-but-unacknowledged');
        Route::get('supply-orders/unsigned', 'PracticeManagementController@supplyOrdersUnsigned')->name('supply-orders-unsigned');

        Route::get('remote-monitoring', 'PracticeManagementController@remoteMonitoring')->name('remote-monitoring');
        Route::get('remote-monitoring-count', 'PracticeManagementController@remoteMonitoringCount')->name('remote-monitoring-count');

        Route::get('rpm-mcp', 'PracticeManagementController@remoteMonitoringMCP')->name('rpm-matrix-mcp');
        Route::get('rpm-rmm', 'PracticeManagementController@remoteMonitoringRMM')->name('rpm-matrix-rmm');
        Route::get('rpm-rme', 'PracticeManagementController@remoteMonitoringRME')->name('rpm-matrix-rme');


        //stat tree stuff
        Route::name('clauses.')->prefix('clauses/')->group(function () {
            Route::get('', 'ClauseController@list')->name('list');
            Route::get('replace-all', 'ClauseController@replaceAllPage')->name('replaceAllPage');
        });
        Route::name('statTrees.')->prefix('stat-trees')->group(function () {
            Route::get('', 'StatTreeController@list')->name('list');
            Route::get('create', 'StatTreeController@createPage')->name('createPage');
            Route::name('view.')->prefix('view/{statTree}')->group(function () {
                Route::get('', 'StatTreeController@dashboard2')->name('dashboard');
                Route::get('edit', 'StatTreeController@edit')->name('edit');
                Route::get('clausesJSON', 'StatTreeController@clausesJSON')->name('clausesJSON');
                Route::get('linesJSON', 'StatTreeController@linesJSON')->name('linesJSON');

                Route::get('old', 'StatTreeController@dashboard')->name('dashboard2');
            });
            Route::post('instantiate/{statTree}', 'StatTreeController@instantiate')->name('instantiate');
            Route::post('clone/{statTree}', 'StatTreeController@clone')->name('clone');
        });
        Route::name('statTreeLines.')->prefix('stat-tree-lines/')->group(function () {
            Route::get('', 'StatTreeLineController@list')->name('list');
            Route::name('view.')->prefix('view/{statTreeLine}')->group(function () {
                Route::get('', 'StatTreeLineController@dashboard')->name('dashboard');
            });
            Route::get('view-data/{line}', 'StatTreeLineController@viewData')->name('view-data');
        });

        Route::name('statTreeLineReports.')->prefix('stat-tree-line-reports/')->group(function () {
            Route::get('', 'StatTreeLineController@reports')->name('reports');
            Route::get('edit/{statTreeLine}', 'StatTreeLineController@editReport')->name('edit');
            Route::get('view/{statTreeLine}', 'StatTreeLineController@viewReport')->name('view');
        });


        // APIs
        Route::name('api.')->group(function () {
            //Clause
            Route::name('clause.')->prefix('clause/')->group(function () {
                Route::post('replace-all', 'ClauseController@replaceAll')->name('replaceAll');
                Route::post('create', 'ClauseController@create')->name('create');
                Route::post('update', 'ClauseController@update')->name('update');
                Route::post('remove', 'ClauseController@remove')->name('remove');
            });

            //Clause Arg
            Route::name('clauseArg.')->prefix('clause-arg/')->group(function () {
                Route::post('create', 'ClauseArgController@create')->name('create');
                Route::post('update', 'ClauseArgController@update')->name('update');
                Route::post('remove', 'ClauseArgController@remove')->name('remove');
            });

            //Stat Tree
            Route::name('statTree.')->prefix('stat-tree/')->group(function () {
                Route::post('create', 'StatTreeController@create')->name('create');
                Route::post('remove', 'StatTreeController@remove')->name('remove');
                Route::post('update-basic', 'StatTreeController@updateBasic')->name('updateBasic');
                Route::post('refresh-count', 'StatTreeController@refreshCount')->name('refreshCount');
                Route::post('replace-all-lines', 'StatTreeController@replaceAllLines')->name('replaceAllLines');
                Route::post('replace-all-lines-json', 'StatTreeController@replaceAllLinesJSON')->name('replaceAllLinesJSON');
                Route::post('refresh-tree-count-queries', 'StatTreeController@refreshTreeCountQueries')->name('refreshTreeCountQueries');
                Route::post('get-counts-for-pro', 'StatTreeController@getCountsForPro')->name('getCountsForPro');
                Route::any('get-counts-for-pros', 'StatTreeController@getCountsForPros')->name('getCountsForPros');
            });

            //Stat Tree Line
            Route::name('statTreeLine.')->prefix('stat-tree-line/')->group(function () {
                Route::post('refresh-count-query', 'StatTreeLineController@refreshCountQuery')->name('refreshCountQuery');
                Route::post('create', 'StatTreeLineController@create')->name('create');
                Route::post('remove', 'StatTreeLineController@remove')->name('remove');
            });

            //Stat Tree Line Report Column
            Route::name('statTreeLineReportColumn.')->prefix('stat-tree-line-report-column/')->group(function () {
                Route::post('create', 'StatTreeLineReportColumnController@create')->name('create');
                Route::post('update', 'StatTreeLineReportColumnController@update')->name('update');
                Route::post('remove', 'StatTreeLineReportColumnController@remove')->name('remove');
            });

            //Stat Tree Line Reports
            Route::name('statTreeLineReport.')->prefix('stat-tree-line-report/')->group(function () {
                Route::post('refresh-count-query', 'StatTreeLineController@refreshCountQuery')->name('refreshCountQuery');
                Route::post('create', 'StatTreeLineController@createReport')->name('create');
                Route::post('remove', 'StatTreeLineController@removeReport')->name('remove');
                Route::post('updateTitle', 'StatTreeLineController@updateTitle')->name('updateTitle');
                Route::post('updateModel', 'StatTreeLineController@updateModel')->name('updateModel');
                Route::post('addExistingClause', 'StatTreeLineController@addExistingClause')->name('addExistingClause');
                Route::post('addNewClause', 'StatTreeLineController@addNewClause')->name('addNewClause');
                Route::post('removeClause', 'StatTreeLineController@removeClause')->name('removeClause');
                Route::post('addReportColumn', 'StatTreeLineController@addReportColumn')->name('addReportColumn');
                Route::post('updateReportColumn', 'StatTreeLineController@updateReportColumn')->name('updateReportColumn');
                Route::post('removeReportColumn', 'StatTreeLineController@removeReportColumn')->name('removeReportColumn');
                Route::post('reorderReportColumns', 'StatTreeLineController@reorderReportColumns')->name('reorderReportColumns');
            });
        });

    });

    // Route::middleware('pro.auth.admin')->group(function () {
        Route::get('patients/view/mcp-requests/{patient?}', 'PatientController@mcpRequests')->name('patients.view.mcp-requests');
        Route::get('patients/view/eligible-refreshes/{patient}', 'PatientController@eligibleRefreshes')->name('patients.view.eligible-refreshes');
        Route::get('patients/view/insurance-coverage/{patient}', 'PatientController@insuranceCoverage')->name('patients.view.insurance-coverage');
        Route::get('patients/view/client-primarycoverages/{patient}', 'PatientController@clientPrimaryCoverages')->name('patients.view.client-primary-coverages');
        Route::get('patients/view/primary-coverage/{patient}', 'PatientController@primaryCoverage')->name('patients.view.primary-coverage');
        Route::get('patients/view/client-pro-access/{patient}', 'PatientController@clientProAccess')->name('patients.view.client-pro-access');

        Route::get('patients/view/client-documents/{patient}', 'PatientController@clientDocuments')->name('patients.view.client-documents');

        Route::get('patients/view/primary-coverage-form/{patient}', 'PatientController@primaryCoverageForm')->name('patients.view.primary-coverage-form');
        Route::get('patients/view/primary-coverage-manual-determination-modal/{patient}', 'PatientController@primaryCoverageManualDeterminationModal')->name('patients.view.primary-coverage-manual-determination-modal');
    // });

    Route::name('patients.view.')->prefix('patients/view/{patient}')->group(function () {

        Route::middleware(['pro.auth.can-access-patient', 'client.not-shadow-of-pro'])->group(function () {

            Route::get('', 'PatientController@dashboard')->name('dashboard');
            Route::get('canvas-migrate', 'PatientController@canvasMigrate')->name('migrate-canvas');
            Route::get('intake', 'PatientController@intake')->name('intake');
            Route::get('canvas', 'PatientController@canvas')->name('canvas');
            Route::get('intake', 'PatientController@intake')->name('intake');
            Route::get('care-plan', 'PatientController@carePlan')->name('care-plan');
            Route::get('medications', 'PatientController@medications')->name('medications');
            Route::get('dx-and-focus-areas', 'PatientController@dxAndFocusAreas')->name('dx-and-focus-areas');
            Route::get('care-team', 'PatientController@careTeam')->name('care-team');
            Route::get('devices', 'PatientController@devices')->name('devices');
            Route::get('measurements', 'PatientController@measurements')->name('measurements');
            Route::get('labs-and-studies', 'PatientController@labsAndStudies')->name('labs-and-studies');
            Route::get('history', 'PatientController@history')->name('history');
            Route::get('memos', 'PatientController@memos')->name('memos');
            Route::get('sms', 'PatientController@sms')->name('sms');
            Route::get('outgoing-sms-log', 'PatientController@outgoingSmsLog')->name('outgoing-sms-log');
            Route::get('review-requests', 'PatientController@reviewRequests')->name('review-requests');

            Route::get('show-set-company-client', [CompanyClientController::class, 'showSetCompanyClient'])->name('show-set-company-client');
            Route::get('show-set-default-company-client', [CompanyClientController::class, 'showSetDefaultCompanyClient'])->name('show-set-default-company-client');
            Route::post('set-default-company-client', [CompanyClientController::class, 'setDefaultCompanyClient'])->name('set-default-company-client');
            Route::middleware([])->group(function () {
                Route::get('customers', [CustomerController::class, 'customers'])->name('customers');
                Route::get('customers/view/{slug}', [CustomerController::class, 'customer'])->name('customer');
                Route::middleware(['client.has-default-company-client'])->group(function () {
                    Route::get('messages', [MessageController::class, 'messages'])->name('messages');
                    Route::get('messages/{message}/attachments', [MessageController::class, 'clientMessagesAttachments'])->name('messages-attachments');
                });
            });

            Route::get('sms-numbers', 'PatientController@smsNumbers')->name('sms-numbers');
            Route::get('immunizations', 'PatientController@immunizations')->name('immunizations');
            Route::get('allergies', 'PatientController@allergies')->name('allergies');

            Route::get('notes/{filter?}', 'PatientController@notes')->name('notes');
            Route::name('notes.view.')->prefix('notes/view/{note}')->group(function () {
                Route::get('', 'NoteController@dashboard')->name('dashboard');
                Route::get('sign-confirmation', 'NoteController@signConfirmation')->name('sign-confirmation');
                Route::get('section-view/{section}/{view}/{page?}', 'NoteController@sectionView')->name('section-view');
            });
            Route::get('generic-bills', 'PatientController@genericBills')->name('generic-bills');
            Route::get('handouts', 'PatientController@handouts')->name('handouts');
            Route::get('rm-setup', 'PatientController@rmSetup')->name('rm-setup');
            Route::get('settings', 'PatientController@settings')->name('settings');
            Route::get('sms-reminders', 'PatientController@smsReminders')->name('sms-reminders');
            Route::get('measurement-confirmation-numbers', 'PatientController@measurementConfirmationNumbers')->name('measurement-confirmation-numbers');
            Route::get('pros', 'PatientController@pros')->name('pros');
            Route::get('pro-changes', 'PatientController@proChanges')->name('pro-changes');
            Route::get('account', 'PatientController@account')->name('account');
            Route::get('care-checklist', 'PatientController@careChecklist')->name('care-checklist');
            Route::get('documents', 'PatientController@documents')->name('documents');
            Route::get('incoming-reports/{currentReport?}', 'PatientController@incomingReports')->name('incoming-reports');
            Route::get('education', 'PatientController@education')->name('education');
            Route::get('insurance-coverage-history', 'PatientController@insuranceCoverageHistory')->name('insurance-coverage-history');
            Route::get('messaging', 'PatientController@messaging')->name('messaging');
            Route::get('duplicate', 'PatientController@duplicate')->name('duplicate');
            Route::get('care-months', 'PatientController@careMonths')->name('care-months');
            Route::name('care-months.view.')->prefix('care-months/view/{careMonth}')->group(function () {
                Route::get('', 'CareMonthController@dashboard')->name('dashboard');
            });

            // appointment calendar
            Route::get('calendar/{currentAppointment?}', 'PatientController@calendar')->name('calendar');

            // flowsheets
            Route::get('flowsheets/{filter?}', 'PatientController@flowsheets')->name('flowsheets');

            // vitals-settings
            Route::get('vitals-settings/{filter?}', 'PatientController@vitalsSettings')->name('vitals-settings');

            // vitals-graph
            Route::get('vitals-graph/{filter?}', 'PatientController@vitalsGraph')->name('vitals-graph');

            // sleep study
            Route::get('sleep-study/{filter?}', 'PatientController@sleepStudy')->name('sleep-study');
            Route::get('sleep-study-step', 'PatientController@sleepStudyStep')->name('sleep-study-step');

            // tickets (old/deprecated)
            Route::get('tickets/{type?}/{currentTicket?}', 'PatientController@tickets')->name('patient-tickets');

            // invoicing
            Route::get('invoicing/companies', 'PatientController@invoicingCompanies')->name('invoicing-companies');
            Route::get('invoicing/invoices/{customer}', 'PatientController@invoicingInvoices')->name('invoicing-invoices');
            Route::get('invoicing/customer-transactions/{customer}', 'PatientController@invoicingCustomerTransactions')->name('invoicing-customer-transactions');
            Route::get('invoicing/invoice-transactions/{invoice}', 'PatientController@invoicingInvoiceTransactions')->name('invoicing-invoice-transactions');
            Route::get('invoicing/invoice-transactions-in-popup/{invoice}', 'PatientController@invoicingInvoiceTransactionsInPopup')->name('invoicing-invoice-transactions-in-popup');

            // prescriptions (new)
            Route::get('prescriptions/{type?}/{currentErx?}', 'PatientController@prescriptions')->name('patient-prescriptions');
            Route::get('prescriptions-popup/{type?}/{currentErx?}', 'PatientController@prescriptionsPopup')->name('patient-prescriptions-popup');
            Route::get('prescriptions-list/{type?}/{currentErx?}', 'PatientController@prescriptionsList')->name('patient-prescriptions-list');

            // appointments
            Route::get('appointments/{forPro}/{status}', 'PatientController@appointments')->name('appointments');

            Route::get('supply-orders/{supplyOrder?}', 'PatientController@supplyOrders')->name('supply-orders');
            Route::get('shipments/{shipment?}', 'PatientController@shipments')->name('shipments');

            // CLAIMS RESOLVER
            Route::get('claims-resolver', 'PatientController@claimsResolver')->name('claims-resolver');

            Route::get('accounts', 'PatientController@accounts')->name('accounts');

            Route::get('companies', 'PatientController@companies')->name('companies');

            Route::get('rtm', 'PatientController@rtm')->name('rtm');

        });

    });

    Route::get('/protocol-builder/{patient}', 'PatientController@protocolBuilder')->name('protocol-builder');
    Route::get('/point/edit-hpi/{note}/{point}', 'NoteController@editHPI')->name('point-edit-hpi');
    Route::get('/point/hpi-log/{point}', 'NoteController@hpiLog')->name('point-hpi-log');
    Route::get('/point/review-log/{point}', 'NoteController@reviewLog')->name('point-review-log');
    Route::get('/point/plan-log/{point}', 'NoteController@planLog')->name('point-plan-log');
    Route::get('/note/pdf/{note}', 'NoteController@downloadAsPdf')->name('note-pdf');
    Route::get('/note/generate-cc/{note}', 'NoteController@generateCC')->name('note-generate-cc');
    Route::get('/note/ccm-agreement/{note}', 'NoteController@ccmAgreement')->name('ccm-agreement');
    Route::get('/note/rpm-agreement/{note}', 'NoteController@rpmAgreement')->name('rpm-agreement');
    Route::get('/segment-summary/{segment}', 'NoteController@segmentSummary')->name('segment-summary');
    Route::get('/mrv-summary/{note}', 'NoteController@mrvSummary')->name('mrv-summary');
    Route::get('/note-segment-view/{patient}/{note}/{segment}/{segmentInternalName}/{view}', 'NoteController@noteSegmentView')->name('note-segment-view');
    Route::get('/note-segment-view-by-name/{note}/{segmentInternalName}/{view}', 'NoteController@noteSegmentViewByName')->name('note-segment-view-by-name');
    Route::get('/module-view/{note}/{segmentInternalName}/{view}', 'NoteController@moduleView')->name('module-view');
    Route::get('/chart-segment-view/{patient}/{segmentInternalName}/{view}', 'NoteController@chartSegmentView')->name('chart-segment-view');
    Route::get('/note-rhs-sidebar/{patient}/{note}', 'NoteController@rhsSidebar')->name('note-rhs-sidebar');
    Route::get('/medications-center/{patient}/{note}', 'NoteController@medicationsCenter')->name('medications-center');
    Route::get('/medications-add-multi-preexisting/{note}', 'NoteController@medicationsAddMultiPreexisting')->name('medications-add-multi-preexisting');
    Route::get('/medications-reconcile/{patient}/{note}', 'NoteController@medicationsReconcile')->name('medications-reconcile');
    Route::get('/problems-center/{patient}/{note}', 'NoteController@problemsCenter')->name('problems-center');
    Route::get('/goals-center/{patient}/{note}', 'NoteController@goalsCenter')->name('goals-center');
    Route::get('/allergies-center/{patient}/{note}', 'NoteController@allergiesCenter')->name('allergies-center');
    Route::get('/careteam-center/{patient}/{note}', 'NoteController@careteamCenter')->name('careteam-center');
    Route::get('/supplements-center/{patient}/{note}', 'NoteController@supplementsCenter')->name('supplements-center');
    Route::get('/supplements-reconcile/{patient}/{note}', 'NoteController@supplementsReconcile')->name('supplements-reconcile');
    Route::get('/memos-thread/{patient}', 'PatientController@memosThread')->name('memos-thread');
    Route::get('/messages-thread/{patient}', 'PatientController@messagesThread')->name('messages-thread');

    Route::get('/nutrition-center/{patient}/{note}', 'NoteController@nutritionCenter')->name('nutrition-center');
    Route::get('/exercise-center/{patient}/{note}', 'NoteController@exerciseCenter')->name('exercise-center');
    Route::get('/behavior-center/{patient}/{note}', 'NoteController@behaviorCenter')->name('behavior-center');

    Route::get('/problems-quick-add/{patient}/{note}', 'NoteController@problemsQuickAdd')->name('problems-quick-add');

    //mb claim single view
    Route::get('mb-claims/view/{mbClaim}', 'PatientController@mbClaim')->name('mb-claim');

    // AJAX - used by process-claims
    Route::get('claims/current-mb-claim/{claimUid}', 'PracticeManagementController@currentMbClaim')->name('current-mb-claim');
    Route::get('claims/current-claim-lines/{claimUid}', 'PracticeManagementController@currentClaimLines')->name('current-claim-lines');

    // pro dashboard events (ajax)
    Route::get('pro-dashboard-event-dates/{from}/{to}', 'HomeController@dashboardAppointmentDates')->name('pro-dashboard-event-dates');
    Route::get('pro-dashboard-events/{from}/{to}', 'HomeController@dashboardAppointments')->name('pro-dashboard-events');
    Route::get('pro-dashboard-events-display/{from}/{to}', 'HomeController@dashboardAppointmentsDisplay')->name('pro-dashboard-events-display');

    // pro dashboard measurements
    Route::get('pro-dashboard-measurements/{filter}', 'HomeController@dashboardMeasurements')->name('pro-dashboard-measurements');

    // events for fc
    Route::get('/appointment/getAllAppointmentsForPros', 'AppointmentController@events')->name('events');

    //events for availability
    Route::post('/availability/load/{proUid}', 'PracticeManagementController@loadAvailability')->name('loadAvailability');
    Route::post('/pro-availability/filter', 'PracticeManagementController@proAvailabilityFilter')->name('pro-availability-filter');

    // load template set
    Route::get('/note-template-set/exam/{exam}/{template}', 'HomeController@noteExamTemplateSet');
    Route::get('/note-template-set/{section}/{template}', 'HomeController@noteTemplateSet');

    // Patient suggest
    Route::get('/patients-suggest', 'HomeController@patientsSuggest');

    // column suggest
    Route::get('/column-suggest', 'StatTreeLineController@columnSuggest');

    // Pharmacy suggest
    Route::get('/pharmacy-suggest', 'HomeController@pharmacySuggest');

    // Company/client suggest
    Route::get('/company-suggest', 'InvoiceController@companySuggestJSON')->name('company-suggest-json');
    Route::get('/client-suggest', 'InvoiceController@clientSuggestJSON')->name('client-suggest-json');
    Route::get('/customer-suggest', 'InvoiceController@customerSuggestJSON')->name('customer-suggest-json');
    Route::get('/customer/invoicesJSON/{customer}', 'InvoiceController@customerInvoicesJSON')->name('customer-invoices-json');

    // Pro suggest
    Route::get('/pro-suggest', 'HomeController@proSuggest');
    Route::get('/pro-display-name/{pro}', 'HomeController@proDisplayName');
    Route::get('/pro-uid/{id}', 'HomeController@proUid');

    // embeddable sections
    Route::get('/embed/{patient}/{section}/{selectable}', 'PatientController@embedSection')->name('embed-section');

    // AJAX presence poll
    Route::get('/patients/{patient}/presence', 'PatientController@presence');

    // refresh single ticket
    Route::get('/get-ticket/{ticket}', 'HomeController@getTicket');

    // rpm matrix single row
    Route::get('/rpm-matrix-row', 'PracticeManagementController@remoteMonitoring_Row');

    Route::get('rpm-matrix-row-mcp', 'PracticeManagementController@remoteMonitoring_RowMCP')->name('rpm-matrix-row-mcp');
    Route::get('rpm-matrix-row-rmm', 'PracticeManagementController@remoteMonitoring_RowRMM')->name('rpm-matrix-row-rmm');
    Route::get('rpm-matrix-row-rme', 'PracticeManagementController@remoteMonitoring_RowRME')->name('rpm-matrix-row-rme');
    Route::get('rpm-matrix-row-admin', 'PracticeManagementController@remoteMonitoring_RowADMIN')->name('rpm-matrix-row-admin');

    Route::get('/appointment-confirmation-history/{appointment}', 'AppointmentController@appointmentConfirmationHistory')->name('appointment-confirmation-history');

    // 2-pane outer page housing lhs (practice management) and rhs (video call)
    Route::get('/mc/{fragment?}', 'HomeController@mc')
        ->where('fragment', '.*')
        ->name('mc');

    // pro meeting
    Route::get('/pro/check-video/{uid}', 'PracticeManagementController@checkVideo');
    Route::get('/pro/meet/{uid?}', 'PracticeManagementController@meet');
    Route::post('/pro/meet/get-participant-info', 'PracticeManagementController@getParticipantInfo');
    Route::get('/pro/get-opentok-session-key/{uid}', 'PracticeManagementController@getOpentokSessionKey');
    Route::get('/patients-in-queue', 'PracticeManagementController@getPatientsInQueue');
    Route::get('/current-work', 'PracticeManagementController@currentWork');

    //Notes stuff
    Route::get('/note/{note_uid}', 'NoteController@renderNote')->name('render-note');
    Route::get('/section_create_form/{note_uid}/{section_template_uid}', 'NoteController@sectionCreateForm')->name('section_create_form');
    Route::get('/section_update_form/{section_uid}', 'NoteController@sectionUpdateForm')->name('section_update_form');

    // generic bills modal
    Route::get('/generic-bill-view/{entityType}/{entityUid}', 'HomeController@genericBill')->name('generic-bill-view');

    Route::get("/log_in_as", 'HomeController@logInAs')->name('log-in-as');
    Route::post("/process-log_in_as", 'HomeController@processLogInAs')->name('process-log-in-as');
    Route::post("/back_to_admin_pro", 'HomeController@backToAdminPro')->name('back-to-admin-pro');

    Route::get('/remote-monitoring-measurements/{careMonth}', 'PracticeManagementController@remoteMonitoringMeasurements')->name('remote-monitoring-measurements');


    Route::get('/patient-care-month-matrix/{careMonth}', 'PatientController@careMonthMatrix')->name('patient-care-month-matrix');
    Route::get('/pro-care-month-report', 'PracticeManagementController@careMonthReport')->name('pro-care-month-report');

    // fdb playground
    Route::get('/fdb-pg-rx', 'FDBPGController@rx')->name('fdb-pg-rx');
    Route::get('/fdb-med-suggest', 'FDBPGController@medSuggest');
    Route::get('/fdb-med-suggest/json', 'FDBPGController@medSuggestJSON');
    Route::get('/fdb-med-suggest-v2/json', 'FDBPGController@medSuggestV2JSON');
    Route::get('/fdb-routed-meds', 'FDBPGController@routedMeds');
    Route::get('/fdb-routed-dosages', 'FDBPGController@routedDosages');
    Route::get('/fdb-meds', 'FDBPGController@meds');
    Route::get('/fdb-side-effects', 'FDBPGController@sideEffects');
    Route::get('/fdb-geriatric-precautions', 'FDBPGController@geriatricPrecautions');
    Route::get('/fdb-indications', 'FDBPGController@indications');
    Route::get('/fdb-contraindications', 'FDBPGController@contraindications');
    Route::get('/fdb-dx-suggest', 'FDBPGController@dxSuggest');
    Route::get('/fdb-dx-suggest/json', 'FDBPGController@dxSuggestJSON');
    Route::get('/fdb-dx-suggest-v2/json', 'FDBPGController@dxSuggestV2JSON');
    Route::get('/fdb-dx-icds-for-dxid', 'FDBPGController@dxICDsForDxID');
    Route::get('/fdb-allergy-suggest', 'FDBPGController@allergySuggest');
    Route::get('/fdb-allergy-suggest/json', 'FDBPGController@allergySuggestJSON');
    Route::any('/fdb-drug-allergies', 'FDBPGController@drugAllergies');
    Route::any('/fdb-drug-drug-interaction', 'FDBPGController@drugDrugInteraction');
    Route::any('/fdb-drug-coadministration', 'FDBPGController@drugCoadministration');
    Route::any('/fdb-duplicate-therapy', 'FDBPGController@duplicateTherapy');

    Route::any('/fdb-rx-vigilance/{patient}', 'FDBPGController@rxVigilance');
    Route::any('/fdb-dx-vigilance/{patient}', 'FDBPGController@dxVigilance');
    Route::any('/fdb-allergy-vigilance/{patient}', 'FDBPGController@allergyVigilance');

    Route::get('/search-payer/json', 'PayerController@searchPayerV2JSON')->name('searchPayerV2JSON');
    Route::get('/search-facility/json', 'HomeController@facilitySuggestJSON')->name('facilitySuggestJSON');

    Route::get('print-note/{patient}/{note}', 'NoteController@print')->name('print-note');
    Route::get('print-note-v2/{patient}/{note}', 'NoteController@printV2')->name('print-note-v2');
    Route::get('print-note-v3/{patient}/{note}', 'NoteController@printV3')->name('print-note-v3');
    Route::get('resolve-note/{patient}/{note}', 'NoteController@resolve')->name('resolve-note');

    Route::get('check-if-cpt-code-is-submitted', 'PatientController@checkIfCptCodeIsSubmitted')->name('check-if-cpt-code-is-submitted');

});

Route::get("/get-default-section-data/{patientID}/{sectionTemplateID}", 'NoteController@getDefaultValueForSection')->name('get_default_section_data');

Route::get("/get-segment-html/{segmentUid}/{sessionKey}", 'NoteController@getHtmlForSegment')->name('get_segment_html');
Route::get("/ougoing-email-templates", 'HomeController@outgoingEmailTemplates')->name('outgoingEmailTemplates');
Route::any("/nop", 'HomeController@nop')->name('nop');

Route::get('/document-pdf/{uid}', 'DocumentsController@generateDocumentPDF')->name('generateDocumentPDF');

// ic pages - client facing
Route::get('/ic/home/{sessionKey?}', 'InvoiceController@icCustomerPortal')->name('icCustomerPortal');
Route::get('/ic/pay/{invoiceUid}/{sessionKey?}', 'InvoiceController@icPayInvoice')->name('icPayInvoice');
Route::get('/ic/manageAccount/{sessionKey?}', 'InvoiceController@icManageAccount')->name('icManageAccount');
Route::get('/ic/payment-methods/{sessionKey?}', 'InvoiceController@icPaymentMethods')->name('icPaymentMethods');

Route::get('/serve-system-file/{uid}', [SystemFileController::class, 'serve'])->name('serve-system-file');
Route::get("/video-test", [VideoTestController::class, 'index'])->name('video-test');
Route::get('/archive/{archiveId}', [VideoTestController::class, 'getArchive'])->name('get_archive');
Route::post('/start/{sessionId}', [VideoTestController::class, 'startRecording'])->name('start_recording');
Route::post('/stop/{archiveId}', [VideoTestController::class, 'stopRecording'])->name('stop_recording');
Route::post('/save-archive', [VideoTestController::class, 'saveArchive'])->name('save_archive');
Route::post('/upload-video', [VideoTestController::class, 'uploadVideo'])->name('upload_video');
