<?php

use App\Http\Controllers\Auth\SsoLoginController;
use App\Http\Controllers\WalletBalanceController;
use App\Http\Controllers\Care\AiController;
use App\Http\Controllers\Care\AppointmentController;
use App\Http\Controllers\Care\AppointmentMeetController;
use App\Http\Controllers\Care\AssessmentController;
use App\Http\Controllers\Care\AuditLogController;
use App\Http\Controllers\Care\BillController;
use App\Http\Controllers\Care\BranchController;
use App\Http\Controllers\Care\ConsultationController;
use App\Http\Controllers\Care\DashboardController;
use App\Http\Controllers\Care\DepartmentController;
use App\Http\Controllers\Care\CareUnitController;
use App\Http\Controllers\Care\BedController;
use App\Http\Controllers\Care\StaffAssignmentController;
use App\Http\Controllers\Care\VisitPlacementController;
use App\Http\Controllers\Care\MarController;
use App\Http\Controllers\Care\NursingDocumentationController;
use App\Http\Controllers\Care\NursingAssessmentController;
use App\Http\Controllers\Care\NursePerformanceController;
use App\Http\Controllers\Care\ShiftController;
use App\Http\Controllers\Care\RosterController;
use App\Http\Controllers\Care\NursingServicesController;
use App\Http\Controllers\Care\NurseStationController;
use App\Http\Controllers\Care\MyShiftsController;
use App\Http\Controllers\Care\DeviceController;
use App\Http\Controllers\Care\DisplayPublicController;
use App\Http\Controllers\Care\DisplayScreenController;
use App\Http\Controllers\Care\DrugController;
use App\Http\Controllers\Care\FinancialObligationController;
use App\Http\Controllers\Care\IntegrationsController;
use App\Http\Controllers\Care\InvestigationController;
use App\Http\Controllers\Care\InvestigationTypeController;
use App\Http\Controllers\Care\IssueReportController;
use App\Http\Controllers\Care\MemberController;
use App\Http\Controllers\Care\OnboardingController;
use App\Http\Controllers\Care\OutcomeController;
use App\Http\Controllers\Care\PathwayController;
use App\Http\Controllers\Care\PatientController;
use App\Http\Controllers\Care\PatientMessageController;
use App\Http\Controllers\Care\PractitionerController;
use App\Http\Controllers\Care\PrescriptionController;
use App\Http\Controllers\Care\ProController;
use App\Http\Controllers\Care\QueueController;
use App\Http\Controllers\Care\ReportController;
use App\Http\Controllers\Care\ServiceQueueController;
use App\Http\Controllers\Care\SettingsController;
use App\Http\Controllers\Care\SettingsGpPricingController;
use App\Http\Controllers\Care\SettingsModulesController;
use App\Http\Controllers\Care\DentistryWorkspaceController;
use App\Http\Controllers\Care\BloodBankAdminController;
use App\Http\Controllers\Care\BloodBankWorkspaceController;
use App\Http\Controllers\Care\LabAdminController;
use App\Http\Controllers\Care\EmergencyWorkspaceController;
use App\Http\Controllers\Care\OphthalmologyWorkspaceController;
use App\Http\Controllers\Care\PhysiotherapyWorkspaceController;
use App\Http\Controllers\Care\WomensHealthWorkspaceController;
use App\Http\Controllers\Care\RadiologyWorkspaceController;
use App\Http\Controllers\Care\CardiologyWorkspaceController;
use App\Http\Controllers\Care\PsychiatryWorkspaceController;
use App\Http\Controllers\Care\PediatricsWorkspaceController;
use App\Http\Controllers\Care\OrthopedicsWorkspaceController;
use App\Http\Controllers\Care\EntWorkspaceController;
use App\Http\Controllers\Care\OncologyWorkspaceController;
use App\Http\Controllers\Care\RenalWorkspaceController;
use App\Http\Controllers\Care\SurgeryWorkspaceController;
use App\Http\Controllers\Care\VaccinationWorkspaceController;
use App\Http\Controllers\Care\PathologyWorkspaceController;
use App\Http\Controllers\Care\InfusionWorkspaceController;
use App\Http\Controllers\Care\DermatologyWorkspaceController;
use App\Http\Controllers\Care\PodiatryWorkspaceController;
use App\Http\Controllers\Care\FertilityWorkspaceController;
use App\Http\Controllers\Care\ChildWelfareWorkspaceController;
use App\Http\Controllers\Care\AmbulanceWorkspaceController;
use App\Http\Controllers\Care\SpecialtyModuleController;
use App\Http\Controllers\Care\VisitWorkflowController;
use App\Http\Controllers\NotificationController;
use Illuminate\Support\Facades\Route;

Route::get('/', fn () => auth()->check()
    ? redirect()->route('care.dashboard')
    : redirect()->route('sso.connect'))->name('care.root');

Route::get('/login', [SsoLoginController::class, 'connect'])->name('login');
Route::get('/sso/connect', [SsoLoginController::class, 'connect'])->name('sso.connect');
Route::get('/sso/callback', [SsoLoginController::class, 'callback'])->name('sso.callback');
Route::get('/sso/error', [SsoLoginController::class, 'failed'])->name('sso.failed');
Route::post('/logout', [SsoLoginController::class, 'logout'])->name('logout');
Route::get('/sso/logout-bridge', [SsoLoginController::class, 'logoutBridge'])->name('sso.logout-bridge');
Route::get('/sso/logout-frontchannel', [SsoLoginController::class, 'frontchannelLogout'])->name('sso.logout-frontchannel');
Route::get('/sso/platform-signed-out', [SsoLoginController::class, 'platformSignedOut'])->name('sso.platform-signed-out');
Route::get('/signed-out', fn () => auth()->check() ? redirect()->route('care.dashboard') : view('auth.signed-out'))->name('care.signed-out');

Route::get('/display/{token}', [DisplayPublicController::class, 'show'])->name('care.display.public');
Route::get('/display/{token}/data', [DisplayPublicController::class, 'data'])->name('care.display.data');
Route::post('/display/{token}/announcements/{announcement}/played', [DisplayPublicController::class, 'played'])
    ->name('care.display.announcement.played');

Route::middleware(['care.device:kiosk', 'throttle:60,1'])->prefix('kiosk/d')->group(function () {
    Route::get('/{token}', [\App\Http\Controllers\Care\KioskDeviceController::class, 'show'])->name('care.kiosk.device');
    Route::post('/{token}/issue', [\App\Http\Controllers\Care\KioskDeviceController::class, 'issue'])->name('care.kiosk.device.issue');
});

Route::middleware(['auth', 'platform.session'])->group(function () {
    Route::get('/notifications', [NotificationController::class, 'index'])->name('notifications.index');
    Route::get('/notifications/unread', [NotificationController::class, 'unread'])->name('notifications.unread');
    Route::post('/notifications/{id}/read', [NotificationController::class, 'markAsRead'])->name('notifications.mark-read');
    Route::post('/notifications/mark-all-read', [NotificationController::class, 'markAllAsRead'])->name('notifications.mark-all-read');

    Route::get('/wallet/balance', [WalletBalanceController::class, 'balance'])->name('wallet.balance');

    Route::get('/onboarding', [OnboardingController::class, 'show'])->name('care.onboarding.show');
    Route::post('/onboarding', [OnboardingController::class, 'store'])->name('care.onboarding.store');

    Route::middleware(['care.setup'])->group(function () {
        Route::post('/ai/chat', [AiController::class, 'chat'])->middleware('throttle:30,1')->name('care.ai.chat');

        Route::get('/dashboard', [DashboardController::class, 'index'])->name('care.dashboard');

        Route::get('/patients', [PatientController::class, 'index'])->name('care.patients.index');
        Route::get('/patients/scan', [PatientController::class, 'scanLookup'])->name('care.patients.scan');
        Route::get('/patients/create', [PatientController::class, 'create'])->name('care.patients.create');
        Route::post('/patients', [PatientController::class, 'store'])->name('care.patients.store');
        Route::get('/patients/{patient}', [PatientController::class, 'show'])->name('care.patients.show');
        Route::get('/patients/{patient}/label', [PatientController::class, 'label'])->name('care.patients.label');
        Route::post('/patients/{patient}/email', [PatientMessageController::class, 'sendEmail'])->name('care.patients.email');
        Route::post('/patients/{patient}/sms', [PatientMessageController::class, 'sendSms'])->name('care.patients.sms');
        Route::get('/patients/{patient}/edit', [PatientController::class, 'edit'])->name('care.patients.edit');
        Route::put('/patients/{patient}', [PatientController::class, 'update'])->name('care.patients.update');
        Route::delete('/patients/{patient}', [PatientController::class, 'destroy'])->name('care.patients.destroy');

        Route::get('/appointments', [AppointmentController::class, 'index'])->name('care.appointments.index');
        Route::get('/appointments/create', [AppointmentController::class, 'create'])->name('care.appointments.create');
        Route::post('/appointments', [AppointmentController::class, 'store'])->name('care.appointments.store');
        Route::get('/appointments/walk-in', [AppointmentController::class, 'walkInCreate'])->name('care.appointments.walk-in.create');
        Route::post('/appointments/walk-in', [AppointmentController::class, 'walkInStore'])->name('care.appointments.walk-in.store');
        Route::get('/appointments/{appointment}', [AppointmentController::class, 'show'])->name('care.appointments.show');
        Route::post('/appointments/{appointment}/check-in', [AppointmentController::class, 'checkIn'])->name('care.appointments.check-in');
        Route::post('/appointments/{appointment}/cancel', [AppointmentController::class, 'cancel'])->name('care.appointments.cancel');
        Route::post('/appointments/{appointment}/no-show', [AppointmentController::class, 'noShow'])->name('care.appointments.no-show');
        Route::post('/appointments/{appointment}/schedule-meet', [AppointmentMeetController::class, 'schedule'])->name('care.appointments.schedule-meet');
        Route::post('/appointments/{appointment}/start-meet', [AppointmentMeetController::class, 'start'])->name('care.appointments.start-meet');

        Route::get('/queue', [QueueController::class, 'index'])->name('care.queue.index');
        Route::post('/queue/call-next', [QueueController::class, 'callNext'])->name('care.queue.call-next');
        Route::post('/queue/{appointment}/start', [QueueController::class, 'start'])->name('care.queue.start');
        Route::post('/queue/{appointment}/recall', [QueueController::class, 'recall'])->name('care.queue.recall');
        Route::post('/queue/{appointment}/complete-ticket', [QueueController::class, 'completeTicket'])->name('care.queue.complete-ticket');
        Route::post('/visits/{visit}/workflow/advance', [VisitWorkflowController::class, 'advance'])->name('care.visits.workflow.advance');

        Route::middleware('care.paid')->group(function () {
            Route::get('/service-queues', [ServiceQueueController::class, 'index'])->name('care.service-queues.index');
            Route::get('/service-queues/console/{counterUuid}', [ServiceQueueController::class, 'console'])->name('care.service-queues.console');
            Route::post('/service-queues/console/{counterUuid}/action', [ServiceQueueController::class, 'action'])->name('care.service-queues.action');

            Route::get('/specialty/{module}/visits', [SpecialtyModuleController::class, 'visits'])->name('care.specialty.visits');
            Route::get('/specialty/{module}/history', [SpecialtyModuleController::class, 'history'])->name('care.specialty.history');
            Route::get('/specialty/{module}/billing', [SpecialtyModuleController::class, 'billing'])->name('care.specialty.billing');
            Route::get('/specialty/dentistry/reports', [DentistryWorkspaceController::class, 'reports'])->name('care.specialty.dentistry.reports');
            Route::get('/specialty/emergency/reports', [EmergencyWorkspaceController::class, 'reports'])->name('care.specialty.emergency.reports');
            Route::get('/specialty/blood-bank/reports', [BloodBankWorkspaceController::class, 'reports'])->name('care.specialty.blood-bank.reports');
            Route::get('/specialty/ophthalmology/reports', [OphthalmologyWorkspaceController::class, 'reports'])->name('care.specialty.ophthalmology.reports');
            Route::get('/specialty/physiotherapy/reports', [PhysiotherapyWorkspaceController::class, 'reports'])->name('care.specialty.physiotherapy.reports');
            Route::get('/specialty/womens-health/reports', [WomensHealthWorkspaceController::class, 'reports'])->name('care.specialty.womens_health.reports');
            Route::get('/specialty/maternity/reports', fn () => redirect()->route('care.specialty.womens_health.reports'));
            Route::get('/specialty/radiology/reports', [RadiologyWorkspaceController::class, 'reports'])->name('care.specialty.radiology.reports');
            Route::get('/specialty/cardiology/reports', [CardiologyWorkspaceController::class, 'reports'])->name('care.specialty.cardiology.reports');
            Route::get('/specialty/psychiatry/reports', [PsychiatryWorkspaceController::class, 'reports'])->name('care.specialty.psychiatry.reports');
            Route::get('/specialty/pediatrics/reports', [PediatricsWorkspaceController::class, 'reports'])->name('care.specialty.pediatrics.reports');
            Route::get('/specialty/orthopedics/reports', [OrthopedicsWorkspaceController::class, 'reports'])->name('care.specialty.orthopedics.reports');
            Route::get('/specialty/ent/reports', [EntWorkspaceController::class, 'reports'])->name('care.specialty.ent.reports');
            Route::get('/specialty/oncology/reports', [OncologyWorkspaceController::class, 'reports'])->name('care.specialty.oncology.reports');
            Route::get('/specialty/renal/reports', [RenalWorkspaceController::class, 'reports'])->name('care.specialty.renal.reports');
            Route::get('/specialty/surgery/reports', [SurgeryWorkspaceController::class, 'reports'])->name('care.specialty.surgery.reports');
            Route::get('/specialty/vaccination/reports', [VaccinationWorkspaceController::class, 'reports'])->name('care.specialty.vaccination.reports');
            Route::get('/specialty/pathology/reports', [PathologyWorkspaceController::class, 'reports'])->name('care.specialty.pathology.reports');
            Route::get('/specialty/infusion/reports', [InfusionWorkspaceController::class, 'reports'])->name('care.specialty.infusion.reports');
            Route::get('/specialty/dermatology/reports', [DermatologyWorkspaceController::class, 'reports'])->name('care.specialty.dermatology.reports');
            Route::get('/specialty/podiatry/reports', [PodiatryWorkspaceController::class, 'reports'])->name('care.specialty.podiatry.reports');
            Route::get('/specialty/fertility/reports', [FertilityWorkspaceController::class, 'reports'])->name('care.specialty.fertility.reports');
            Route::get('/specialty/child-welfare/reports', [ChildWelfareWorkspaceController::class, 'reports'])->name('care.specialty.child-welfare.reports');
            Route::get('/specialty/ambulance/reports', [AmbulanceWorkspaceController::class, 'reports'])->name('care.specialty.ambulance.reports');
            Route::get('/specialty/ambulance/new-call', [AmbulanceWorkspaceController::class, 'newCallCreate'])->name('care.specialty.ambulance.new-call');
            Route::post('/specialty/ambulance/new-call', [AmbulanceWorkspaceController::class, 'newCallStore'])->name('care.specialty.ambulance.new-call.store');
            Route::get('/specialty/{module}/workspace/{visit?}', [SpecialtyModuleController::class, 'workspace'])->name('care.specialty.workspace');
            Route::post('/specialty/{module}/workspace/{visit}/clinical', [SpecialtyModuleController::class, 'saveClinical'])->name('care.specialty.clinical.save');
            Route::post('/specialty/{module}/workspace/{visit}/documents', [SpecialtyModuleController::class, 'uploadDocument'])->name('care.specialty.documents.upload');
            Route::post('/specialty/{module}/workspace/{visit}/services', [SpecialtyModuleController::class, 'addService'])->name('care.specialty.services.add');
            Route::post('/specialty/{module}/workspace/{visit}/start-consultation', [SpecialtyModuleController::class, 'startConsultation'])->name('care.specialty.consultation.start');
            Route::post('/specialty/dentistry/workspace/{visit}/tooth', [DentistryWorkspaceController::class, 'updateTooth'])->name('care.specialty.dentistry.tooth');
            Route::post('/specialty/dentistry/workspace/{visit}/dentition', [DentistryWorkspaceController::class, 'setDentition'])->name('care.specialty.dentistry.dentition');
            Route::post('/specialty/dentistry/workspace/{visit}/plan-items', [DentistryWorkspaceController::class, 'addPlanItem'])->name('care.specialty.dentistry.plan-items');
            Route::post('/specialty/dentistry/workspace/{visit}/plan-items/{item}', [DentistryWorkspaceController::class, 'updatePlanItem'])->name('care.specialty.dentistry.plan-items.update');
            Route::post('/specialty/dentistry/workspace/{visit}/plan-items/{item}/cancel', [DentistryWorkspaceController::class, 'cancelPlanItem'])->name('care.specialty.dentistry.plan-items.cancel');
            Route::post('/specialty/dentistry/workspace/{visit}/plan/accept', [DentistryWorkspaceController::class, 'acceptPlan'])->name('care.specialty.dentistry.plan.accept');
            Route::post('/specialty/dentistry/workspace/{visit}/plan/reject', [DentistryWorkspaceController::class, 'rejectPlan'])->name('care.specialty.dentistry.plan.reject');
            Route::post('/specialty/dentistry/workspace/{visit}/plan/cancel', [DentistryWorkspaceController::class, 'cancelPlan'])->name('care.specialty.dentistry.plan.cancel');
            Route::post('/specialty/dentistry/workspace/{visit}/procedures', [DentistryWorkspaceController::class, 'completeProcedure'])->name('care.specialty.dentistry.procedures');
            Route::post('/specialty/dentistry/workspace/{visit}/notes', [DentistryWorkspaceController::class, 'saveNotes'])->name('care.specialty.dentistry.notes');
            Route::post('/specialty/dentistry/workspace/{visit}/images', [DentistryWorkspaceController::class, 'uploadImage'])->name('care.specialty.dentistry.images');
            Route::post('/specialty/dentistry/workspace/{visit}/images/{image}/void', [DentistryWorkspaceController::class, 'voidImage'])->name('care.specialty.dentistry.images.void');
            Route::post('/specialty/dentistry/workspace/{visit}/stage', [DentistryWorkspaceController::class, 'setStage'])->name('care.specialty.dentistry.stage');
            Route::post('/specialty/dentistry/workspace/{visit}/perio', [DentistryWorkspaceController::class, 'savePerio'])->name('care.specialty.dentistry.perio');
            Route::post('/specialty/dentistry/workspace/{visit}/lab-cases', [DentistryWorkspaceController::class, 'createLabCase'])->name('care.specialty.dentistry.lab-cases');
            Route::post('/specialty/dentistry/workspace/{visit}/lab-cases/{labCase}/status', [DentistryWorkspaceController::class, 'transitionLabCase'])->name('care.specialty.dentistry.lab-cases.status');
            Route::post('/specialty/dentistry/workspace/{visit}/recalls', [DentistryWorkspaceController::class, 'scheduleRecall'])->name('care.specialty.dentistry.recalls');
            Route::post('/specialty/dentistry/workspace/{visit}/recalls/{recall}/complete', [DentistryWorkspaceController::class, 'completeRecall'])->name('care.specialty.dentistry.recalls.complete');
            Route::post('/specialty/dentistry/workspace/{visit}/recalls/{recall}/cancel', [DentistryWorkspaceController::class, 'cancelRecall'])->name('care.specialty.dentistry.recalls.cancel');
            Route::get('/specialty/dentistry/workspace/{visit}/print', [DentistryWorkspaceController::class, 'printChart'])->name('care.specialty.dentistry.print');
            Route::post('/specialty/emergency/workspace/{visit}/stage', [EmergencyWorkspaceController::class, 'setStage'])->name('care.specialty.emergency.stage');
            Route::post('/specialty/emergency/workspace/{visit}/vitals', [EmergencyWorkspaceController::class, 'saveVitals'])->name('care.specialty.emergency.vitals');
            Route::post('/specialty/emergency/workspace/{visit}/disposition', [EmergencyWorkspaceController::class, 'saveDisposition'])->name('care.specialty.emergency.disposition');
            Route::get('/specialty/emergency/workspace/{visit}/print', [EmergencyWorkspaceController::class, 'printSummary'])->name('care.specialty.emergency.print');
            Route::post('/specialty/blood-bank/workspace/{visit}/stage', [BloodBankWorkspaceController::class, 'setStage'])->name('care.specialty.blood-bank.stage');
            Route::post('/specialty/blood-bank/workspace/{visit}/issue', [BloodBankWorkspaceController::class, 'confirmIssue'])->name('care.specialty.blood-bank.issue');
            Route::post('/specialty/blood-bank/workspace/{visit}/transfusion', [BloodBankWorkspaceController::class, 'saveTransfusion'])->name('care.specialty.blood-bank.transfusion');
            Route::get('/specialty/blood-bank/workspace/{visit}/print', [BloodBankWorkspaceController::class, 'printSummary'])->name('care.specialty.blood-bank.print');
            Route::post('/specialty/ophthalmology/workspace/{visit}/stage', [OphthalmologyWorkspaceController::class, 'setStage'])->name('care.specialty.ophthalmology.stage');
            Route::post('/specialty/ophthalmology/workspace/{visit}/procedure', [OphthalmologyWorkspaceController::class, 'saveProcedure'])->name('care.specialty.ophthalmology.procedure');
            Route::get('/specialty/ophthalmology/workspace/{visit}/print', [OphthalmologyWorkspaceController::class, 'printSummary'])->name('care.specialty.ophthalmology.print');
            Route::post('/specialty/physiotherapy/workspace/{visit}/stage', [PhysiotherapyWorkspaceController::class, 'setStage'])->name('care.specialty.physiotherapy.stage');
            Route::post('/specialty/physiotherapy/workspace/{visit}/session', [PhysiotherapyWorkspaceController::class, 'saveSession'])->name('care.specialty.physiotherapy.session');
            Route::get('/specialty/physiotherapy/workspace/{visit}/print', [PhysiotherapyWorkspaceController::class, 'printSummary'])->name('care.specialty.physiotherapy.print');
            Route::post('/specialty/womens-health/workspace/{visit}/stage', [WomensHealthWorkspaceController::class, 'setStage'])->name('care.specialty.womens_health.stage');
            Route::post('/specialty/womens-health/workspace/{visit}/postnatal', [WomensHealthWorkspaceController::class, 'savePostnatal'])->name('care.specialty.womens_health.postnatal');
            Route::get('/specialty/womens-health/workspace/{visit}/print', [WomensHealthWorkspaceController::class, 'printSummary'])->name('care.specialty.womens_health.print');
            Route::post('/specialty/radiology/workspace/{visit}/stage', [RadiologyWorkspaceController::class, 'setStage'])->name('care.specialty.radiology.stage');
            Route::post('/specialty/radiology/workspace/{visit}/verification', [RadiologyWorkspaceController::class, 'saveVerification'])->name('care.specialty.radiology.verification');
            Route::get('/specialty/radiology/workspace/{visit}/print', [RadiologyWorkspaceController::class, 'printSummary'])->name('care.specialty.radiology.print');
            Route::post('/specialty/cardiology/workspace/{visit}/stage', [CardiologyWorkspaceController::class, 'setStage'])->name('care.specialty.cardiology.stage');
            Route::post('/specialty/cardiology/workspace/{visit}/procedure', [CardiologyWorkspaceController::class, 'saveProcedure'])->name('care.specialty.cardiology.procedure');
            Route::get('/specialty/cardiology/workspace/{visit}/print', [CardiologyWorkspaceController::class, 'printSummary'])->name('care.specialty.cardiology.print');
            Route::post('/specialty/psychiatry/workspace/{visit}/stage', [PsychiatryWorkspaceController::class, 'setStage'])->name('care.specialty.psychiatry.stage');
            Route::post('/specialty/psychiatry/workspace/{visit}/followup', [PsychiatryWorkspaceController::class, 'saveFollowUp'])->name('care.specialty.psychiatry.followup');
            Route::get('/specialty/psychiatry/workspace/{visit}/print', [PsychiatryWorkspaceController::class, 'printSummary'])->name('care.specialty.psychiatry.print');
            Route::post('/specialty/pediatrics/workspace/{visit}/stage', [PediatricsWorkspaceController::class, 'setStage'])->name('care.specialty.pediatrics.stage');
            Route::post('/specialty/pediatrics/workspace/{visit}/treatment', [PediatricsWorkspaceController::class, 'saveTreatment'])->name('care.specialty.pediatrics.treatment');
            Route::get('/specialty/pediatrics/workspace/{visit}/print', [PediatricsWorkspaceController::class, 'printSummary'])->name('care.specialty.pediatrics.print');
            Route::post('/specialty/orthopedics/workspace/{visit}/stage', [OrthopedicsWorkspaceController::class, 'setStage'])->name('care.specialty.orthopedics.stage');
            Route::post('/specialty/orthopedics/workspace/{visit}/procedure', [OrthopedicsWorkspaceController::class, 'saveProcedure'])->name('care.specialty.orthopedics.procedure');
            Route::get('/specialty/orthopedics/workspace/{visit}/print', [OrthopedicsWorkspaceController::class, 'printSummary'])->name('care.specialty.orthopedics.print');
            Route::post('/specialty/ent/workspace/{visit}/stage', [EntWorkspaceController::class, 'setStage'])->name('care.specialty.ent.stage');
            Route::post('/specialty/ent/workspace/{visit}/procedure', [EntWorkspaceController::class, 'saveProcedure'])->name('care.specialty.ent.procedure');
            Route::get('/specialty/ent/workspace/{visit}/print', [EntWorkspaceController::class, 'printSummary'])->name('care.specialty.ent.print');
            Route::post('/specialty/oncology/workspace/{visit}/stage', [OncologyWorkspaceController::class, 'setStage'])->name('care.specialty.oncology.stage');
            Route::post('/specialty/oncology/workspace/{visit}/treatment', [OncologyWorkspaceController::class, 'saveTreatment'])->name('care.specialty.oncology.treatment');
            Route::get('/specialty/oncology/workspace/{visit}/print', [OncologyWorkspaceController::class, 'printSummary'])->name('care.specialty.oncology.print');
            Route::post('/specialty/renal/workspace/{visit}/stage', [RenalWorkspaceController::class, 'setStage'])->name('care.specialty.renal.stage');
            Route::post('/specialty/renal/workspace/{visit}/plan', [RenalWorkspaceController::class, 'savePlan'])->name('care.specialty.renal.plan');
            Route::get('/specialty/renal/workspace/{visit}/print', [RenalWorkspaceController::class, 'printSummary'])->name('care.specialty.renal.print');
            Route::post('/specialty/surgery/workspace/{visit}/stage', [SurgeryWorkspaceController::class, 'setStage'])->name('care.specialty.surgery.stage');
            Route::post('/specialty/surgery/workspace/{visit}/postop', [SurgeryWorkspaceController::class, 'savePostop'])->name('care.specialty.surgery.postop');
            Route::get('/specialty/surgery/workspace/{visit}/print', [SurgeryWorkspaceController::class, 'printSummary'])->name('care.specialty.surgery.print');
            Route::post('/specialty/vaccination/workspace/{visit}/stage', [VaccinationWorkspaceController::class, 'setStage'])->name('care.specialty.vaccination.stage');
            Route::post('/specialty/vaccination/workspace/{visit}/observation', [VaccinationWorkspaceController::class, 'saveObservation'])->name('care.specialty.vaccination.observation');
            Route::get('/specialty/vaccination/workspace/{visit}/print', [VaccinationWorkspaceController::class, 'printSummary'])->name('care.specialty.vaccination.print');
            Route::post('/specialty/pathology/workspace/{visit}/stage', [PathologyWorkspaceController::class, 'setStage'])->name('care.specialty.pathology.stage');
            Route::post('/specialty/pathology/workspace/{visit}/verification', [PathologyWorkspaceController::class, 'saveVerification'])->name('care.specialty.pathology.verification');
            Route::get('/specialty/pathology/workspace/{visit}/print', [PathologyWorkspaceController::class, 'printSummary'])->name('care.specialty.pathology.print');
            Route::post('/specialty/infusion/workspace/{visit}/stage', [InfusionWorkspaceController::class, 'setStage'])->name('care.specialty.infusion.stage');
            Route::post('/specialty/infusion/workspace/{visit}/monitoring', [InfusionWorkspaceController::class, 'saveMonitoring'])->name('care.specialty.infusion.monitoring');
            Route::get('/specialty/infusion/workspace/{visit}/print', [InfusionWorkspaceController::class, 'printSummary'])->name('care.specialty.infusion.print');
            Route::post('/specialty/dermatology/workspace/{visit}/stage', [DermatologyWorkspaceController::class, 'setStage'])->name('care.specialty.dermatology.stage');
            Route::post('/specialty/dermatology/workspace/{visit}/procedure', [DermatologyWorkspaceController::class, 'saveProcedure'])->name('care.specialty.dermatology.procedure');
            Route::get('/specialty/dermatology/workspace/{visit}/print', [DermatologyWorkspaceController::class, 'printSummary'])->name('care.specialty.dermatology.print');
            Route::post('/specialty/podiatry/workspace/{visit}/stage', [PodiatryWorkspaceController::class, 'setStage'])->name('care.specialty.podiatry.stage');
            Route::post('/specialty/podiatry/workspace/{visit}/procedure', [PodiatryWorkspaceController::class, 'saveProcedure'])->name('care.specialty.podiatry.procedure');
            Route::get('/specialty/podiatry/workspace/{visit}/print', [PodiatryWorkspaceController::class, 'printSummary'])->name('care.specialty.podiatry.print');
            Route::post('/specialty/fertility/workspace/{visit}/stage', [FertilityWorkspaceController::class, 'setStage'])->name('care.specialty.fertility.stage');
            Route::post('/specialty/fertility/workspace/{visit}/cycle', [FertilityWorkspaceController::class, 'saveCycle'])->name('care.specialty.fertility.cycle');
            Route::get('/specialty/fertility/workspace/{visit}/print', [FertilityWorkspaceController::class, 'printSummary'])->name('care.specialty.fertility.print');
            Route::post('/specialty/child-welfare/workspace/{visit}/stage', [ChildWelfareWorkspaceController::class, 'setStage'])->name('care.specialty.child-welfare.stage');
            Route::post('/specialty/child-welfare/workspace/{visit}/followup', [ChildWelfareWorkspaceController::class, 'saveFollowUp'])->name('care.specialty.child-welfare.followup');
            Route::get('/specialty/child-welfare/workspace/{visit}/print', [ChildWelfareWorkspaceController::class, 'printSummary'])->name('care.specialty.child-welfare.print');
            Route::post('/specialty/ambulance/workspace/{visit}/stage', [AmbulanceWorkspaceController::class, 'setStage'])->name('care.specialty.ambulance.stage');
            Route::post('/specialty/ambulance/workspace/{visit}/handover', [AmbulanceWorkspaceController::class, 'saveHandover'])->name('care.specialty.ambulance.handover');
            Route::get('/specialty/ambulance/workspace/{visit}/print', [AmbulanceWorkspaceController::class, 'printSummary'])->name('care.specialty.ambulance.print');
            Route::get('/specialty/{module}', [SpecialtyModuleController::class, 'show'])->name('care.specialty.show');
            Route::post('/specialty/{module}/call-next', [SpecialtyModuleController::class, 'callNext'])->name('care.specialty.call-next');
            Route::post('/specialty/{module}/refer', [SpecialtyModuleController::class, 'refer'])->name('care.specialty.refer');

            Route::get('/lab/admin', [LabAdminController::class, 'index'])->name('care.lab.admin.index');
            Route::get('/lab/requests', [InvestigationController::class, 'index'])->name('care.lab.requests.index');
            Route::get('/lab/queue', [InvestigationController::class, 'queue'])->name('care.lab.queue.index');
            Route::post('/lab/queue/call-next', [InvestigationController::class, 'callNext'])->name('care.lab.queue.call-next');
            Route::post('/lab/queue/{investigation}/serve', [InvestigationController::class, 'serve'])->name('care.lab.queue.serve');
            Route::get('/lab/requests/{investigation}', [InvestigationController::class, 'show'])->name('care.lab.requests.show');
            Route::post('/consultations/{consultation}/investigations', [InvestigationController::class, 'requestFromConsultation'])->name('care.lab.requests.store');
            Route::post('/lab/requests/{investigation}/collect-sample', [InvestigationController::class, 'collectSample'])->name('care.lab.requests.collect-sample');
            Route::post('/lab/requests/{investigation}/start', [InvestigationController::class, 'startProcessing'])->name('care.lab.requests.start');
            Route::post('/lab/requests/{investigation}/results', [InvestigationController::class, 'enterResults'])->name('care.lab.requests.results');
            Route::post('/lab/requests/{investigation}/approve', [InvestigationController::class, 'approve'])->name('care.lab.requests.approve');
            Route::post('/lab/requests/{investigation}/deliver', [InvestigationController::class, 'deliver'])->name('care.lab.requests.deliver');
            Route::post('/lab/requests/{investigation}/cancel', [InvestigationController::class, 'cancel'])->name('care.lab.requests.cancel');

            Route::get('/lab/catalog', [InvestigationTypeController::class, 'index'])->name('care.lab.catalog.index');
            Route::get('/lab/catalog/create', [InvestigationTypeController::class, 'create'])->name('care.lab.catalog.create');
            Route::post('/lab/catalog', [InvestigationTypeController::class, 'store'])->name('care.lab.catalog.store');
            Route::get('/lab/catalog/{investigationType}/edit', [InvestigationTypeController::class, 'edit'])->name('care.lab.catalog.edit');
            Route::put('/lab/catalog/{investigationType}', [InvestigationTypeController::class, 'update'])->name('care.lab.catalog.update');

            Route::get('/blood-bank/admin', [BloodBankAdminController::class, 'index'])->name('care.blood-bank.admin.index');
            Route::post('/blood-bank/admin/stock', [BloodBankAdminController::class, 'updateStock'])->name('care.blood-bank.admin.stock.update');

            Route::get('/prescriptions', [PrescriptionController::class, 'index'])->name('care.prescriptions.index');
            Route::get('/prescriptions/queue', [PrescriptionController::class, 'queue'])->name('care.prescriptions.queue');
            Route::post('/prescriptions/queue/call-next', [PrescriptionController::class, 'callNext'])->name('care.prescriptions.call-next');
            Route::post('/prescriptions/{prescription}/serve', [PrescriptionController::class, 'serve'])->name('care.prescriptions.serve');
            Route::get('/consultations/{consultation}/prescriptions/create', [PrescriptionController::class, 'create'])->name('care.prescriptions.create');
            Route::post('/consultations/{consultation}/prescriptions', [PrescriptionController::class, 'store'])->name('care.prescriptions.store');
            Route::get('/prescriptions/{prescription}', [PrescriptionController::class, 'show'])->name('care.prescriptions.show');
            Route::post('/prescriptions/{prescription}/activate', [PrescriptionController::class, 'activate'])->name('care.prescriptions.activate');
            Route::post('/prescriptions/{prescription}/dispense', [PrescriptionController::class, 'dispense'])->name('care.prescriptions.dispense');
            Route::post('/prescriptions/{prescription}/cancel', [PrescriptionController::class, 'cancel'])->name('care.prescriptions.cancel');

            Route::get('/bills', [BillController::class, 'index'])->name('care.bills.index');
            Route::post('/bills/call-next', [BillController::class, 'callNext'])->name('care.bills.call-next');
            Route::post('/bills/{bill}/serve', [BillController::class, 'serve'])->name('care.bills.serve');
            Route::post('/visits/{visit}/bill', [BillController::class, 'generate'])->name('care.bills.generate');
            Route::get('/bills/payments/callback', [BillController::class, 'paymentCallback'])->name('care.bills.payments.callback');
            Route::get('/bills/{bill}', [BillController::class, 'show'])->name('care.bills.show');
            Route::get('/bills/{bill}/print', [BillController::class, 'print'])->name('care.bills.print');
            Route::post('/bills/{bill}/line-items', [BillController::class, 'addLineItem'])->name('care.bills.line-items.store');
            Route::post('/bills/{bill}/adjustments', [BillController::class, 'applyAdjustments'])->name('care.bills.adjustments');
            Route::post('/bills/{bill}/payments', [BillController::class, 'recordPayment'])->name('care.bills.payments.store');
            Route::post('/bills/{bill}/payments/gateway', [BillController::class, 'startGatewayPayment'])->name('care.bills.payments.gateway');
            Route::post('/bills/{bill}/void', [BillController::class, 'void'])->name('care.bills.void');

            Route::get('/financial-obligations', [FinancialObligationController::class, 'index'])->name('care.obligations.index');
            Route::post('/financial-obligations/{financialObligation}/clear', [FinancialObligationController::class, 'clear'])->name('care.obligations.clear');

            Route::get('/pharmacy/drugs', [DrugController::class, 'index'])->name('care.pharmacy.drugs.index');
            Route::get('/pharmacy/drugs/create', [DrugController::class, 'create'])->name('care.pharmacy.drugs.create');
            Route::post('/pharmacy/drugs', [DrugController::class, 'store'])->name('care.pharmacy.drugs.store');
            Route::get('/pharmacy/drugs/{drug}', [DrugController::class, 'show'])->name('care.pharmacy.drugs.show');
            Route::get('/pharmacy/drugs/{drug}/edit', [DrugController::class, 'edit'])->name('care.pharmacy.drugs.edit');
            Route::put('/pharmacy/drugs/{drug}', [DrugController::class, 'update'])->name('care.pharmacy.drugs.update');
            Route::post('/pharmacy/drugs/{drug}/batches', [DrugController::class, 'receiveBatch'])->name('care.pharmacy.drugs.batches.store');

            Route::get('/reports', [ReportController::class, 'index'])->name('care.reports.index');
            Route::get('/reports/{type}', [ReportController::class, 'show'])->name('care.reports.show');
            Route::get('/reports/{type}/export', [ReportController::class, 'export'])->name('care.reports.export');
        });

        Route::get('/consultations/{consultation}', [ConsultationController::class, 'show'])->name('care.consultations.show');
        Route::put('/consultations/{consultation}', [ConsultationController::class, 'update'])->name('care.consultations.update');
        Route::post('/consultations/{consultation}/complete', [ConsultationController::class, 'complete'])->name('care.consultations.complete');

        // Clinical assessments (gated by CareFeatures::assessments_engine)
        Route::get('/patients/{patient}/assessments', [AssessmentController::class, 'index'])->name('care.assessments.index');
        Route::get('/patients/{patient}/assessments/create', [AssessmentController::class, 'create'])->name('care.assessments.create');
        Route::post('/patients/{patient}/assessments', [AssessmentController::class, 'store'])->name('care.assessments.store');
        // Consultation-scoped: index / create / show (create before {assessment} so "create" is not bound as uuid)
        Route::get('/consultations/{consultation}/assessments', [AssessmentController::class, 'indexForConsultation'])->name('care.consultations.assessments.index');
        Route::get('/consultations/{consultation}/assessments/create', [AssessmentController::class, 'createForConsultation'])->name('care.consultations.assessments.create');
        Route::post('/consultations/{consultation}/assessments', [AssessmentController::class, 'storeForConsultation'])->name('care.consultations.assessments.store');
        Route::get('/consultations/{consultation}/assessments/{assessment}', [AssessmentController::class, 'showForConsultation'])->name('care.consultations.assessments.show');
        Route::get('/assessments/{assessment}', [AssessmentController::class, 'show'])->name('care.assessments.show');
        Route::put('/assessments/{assessment}', [AssessmentController::class, 'update'])->name('care.assessments.update');
        Route::post('/assessments/{assessment}/complete', [AssessmentController::class, 'complete'])->name('care.assessments.complete');
        Route::post('/assessments/{assessment}/cancel', [AssessmentController::class, 'cancel'])->name('care.assessments.cancel');
        Route::get('/assessments/{assessment}/fhir', [AssessmentController::class, 'fhirExport'])->name('care.assessments.fhir');

        // Clinical pathways (Layer 2)
        Route::get('/patients/{patient}/pathways', [PathwayController::class, 'index'])->name('care.pathways.index');
        Route::post('/patients/{patient}/pathways', [PathwayController::class, 'store'])->name('care.pathways.store');
        Route::post('/patients/{patient}/pathways/{patientPathway}/deactivate', [PathwayController::class, 'deactivate'])->name('care.pathways.deactivate');
        Route::get('/consultations/{consultation}/pathway-suggestions', [PathwayController::class, 'suggestions'])->name('care.consultations.pathway-suggestions');

        // Layer 4 — outcomes & patient trends (free per-patient; org analytics Enterprise)
        Route::get('/patients/{patient}/outcomes', [OutcomeController::class, 'index'])->name('care.outcomes.index');
        Route::post('/patients/{patient}/outcomes', [OutcomeController::class, 'store'])->name('care.outcomes.store');

        Route::get('/settings', [SettingsController::class, 'edit'])->name('care.settings');
        Route::put('/settings', [SettingsController::class, 'update'])->name('care.settings.update');
        Route::get('/settings/gp-pricing', [SettingsGpPricingController::class, 'edit'])->name('care.settings.gp-pricing');
        Route::put('/settings/gp-pricing', [SettingsGpPricingController::class, 'update'])->name('care.settings.gp-pricing.update');
        Route::get('/settings/modules', [SettingsModulesController::class, 'edit'])->name('care.settings.modules');
        Route::put('/settings/modules', [SettingsModulesController::class, 'update'])->name('care.settings.modules.update');
        Route::get('/settings/modules/{module}', [SettingsModulesController::class, 'show'])->name('care.settings.modules.show');
        Route::put('/settings/modules/{module}/services', [SettingsModulesController::class, 'updateServices'])->name('care.settings.modules.services.update');
        Route::put('/settings/modules/{module}/service-lines', [SettingsModulesController::class, 'updateServiceLines'])->name('care.settings.modules.service-lines.update');

        Route::get('/integrations', [IntegrationsController::class, 'edit'])->name('care.integrations');
        Route::post('/integrations/sms', [IntegrationsController::class, 'saveSms'])->name('care.integrations.sms.save');
        Route::post('/integrations/sms/disconnect', [IntegrationsController::class, 'disconnectSms'])->name('care.integrations.sms.disconnect');
        Route::post('/integrations/bird', [IntegrationsController::class, 'saveBird'])->name('care.integrations.bird.save');
        Route::post('/integrations/bird/disconnect', [IntegrationsController::class, 'disconnectBird'])->name('care.integrations.bird.disconnect');
        Route::post('/integrations/sms/senders', [IntegrationsController::class, 'previewSenders'])->name('care.integrations.sms.senders');
        Route::post('/integrations/gateway', [IntegrationsController::class, 'saveGateway'])->name('care.integrations.gateway.save');
        Route::post('/integrations/gateway/disconnect', [IntegrationsController::class, 'disconnectGateway'])->name('care.integrations.gateway.disconnect');

        Route::get('/pro', [ProController::class, 'index'])->name('care.pro.index');
        Route::post('/pro/subscribe', [ProController::class, 'subscribe'])->name('care.pro.subscribe');
        Route::post('/pro/subscribe-enterprise', [ProController::class, 'subscribeEnterprise'])->name('care.pro.subscribe-enterprise');
        Route::post('/pro/subscribe-prepaid', [ProController::class, 'subscribePrepaid'])->name('care.pro.subscribe-prepaid');
        Route::get('/pro/paystack/callback', [ProController::class, 'paystackCallback'])->name('care.pro.paystack.callback');

        Route::get('/report-issue', [IssueReportController::class, 'create'])->name('care.issues.create');
        Route::post('/report-issue', [IssueReportController::class, 'store'])->name('care.issues.store');

        Route::get('/settings/branches', [BranchController::class, 'index'])->name('care.branches.index');
        Route::get('/settings/branches/create', [BranchController::class, 'create'])->name('care.branches.create');
        Route::post('/settings/branches', [BranchController::class, 'store'])->name('care.branches.store');
        Route::get('/settings/branches/{branch}/edit', [BranchController::class, 'edit'])->name('care.branches.edit');
        Route::put('/settings/branches/{branch}', [BranchController::class, 'update'])->name('care.branches.update');

        Route::get('/settings/devices', [DeviceController::class, 'index'])->name('care.devices.index');
        Route::get('/settings/devices/create', [DeviceController::class, 'create'])->name('care.devices.create');
        Route::post('/settings/devices', [DeviceController::class, 'store'])->name('care.devices.store');
        Route::get('/settings/devices/{device}/edit', [DeviceController::class, 'edit'])->name('care.devices.edit');
        Route::put('/settings/devices/{device}', [DeviceController::class, 'update'])->name('care.devices.update');
        Route::delete('/settings/devices/{device}', [DeviceController::class, 'destroy'])->name('care.devices.destroy');
        Route::post('/settings/devices/{device}/token', [DeviceController::class, 'regenerateToken'])->name('care.devices.token.regenerate');
        Route::delete('/settings/devices/{device}/token', [DeviceController::class, 'revokeToken'])->name('care.devices.token.revoke');

        Route::middleware('care.paid')->group(function () {
            Route::get('/settings/displays', [DisplayScreenController::class, 'index'])->name('care.displays.index');
            Route::get('/settings/displays/create', [DisplayScreenController::class, 'create'])->name('care.displays.create');
            Route::post('/settings/displays', [DisplayScreenController::class, 'store'])->name('care.displays.store');
            Route::get('/settings/displays/{display}', [DisplayScreenController::class, 'show'])->name('care.displays.show');
            Route::get('/settings/displays/{display}/edit', [DisplayScreenController::class, 'edit'])->name('care.displays.edit');
            Route::put('/settings/displays/{display}', [DisplayScreenController::class, 'update'])->name('care.displays.update');
        });

        Route::redirect('/branches', '/settings/branches');
        Route::redirect('/branches/create', '/settings/branches/create');

        Route::get('/departments', [DepartmentController::class, 'index'])->name('care.departments.index');
        Route::get('/departments/create', [DepartmentController::class, 'create'])->name('care.departments.create');
        Route::post('/departments', [DepartmentController::class, 'store'])->name('care.departments.store');
        Route::get('/departments/{department}/edit', [DepartmentController::class, 'edit'])->name('care.departments.edit');
        Route::put('/departments/{department}', [DepartmentController::class, 'update'])->name('care.departments.update');
        Route::delete('/departments/{department}', [DepartmentController::class, 'destroy'])->name('care.departments.destroy');

        Route::get('/care-units', [CareUnitController::class, 'index'])->name('care.care-units.index');
        Route::get('/care-units/create', [CareUnitController::class, 'create'])->name('care.care-units.create');
        Route::post('/care-units', [CareUnitController::class, 'store'])->name('care.care-units.store');
        Route::get('/care-units/{careUnit}', [CareUnitController::class, 'show'])->name('care.care-units.show');
        Route::get('/care-units/{careUnit}/edit', [CareUnitController::class, 'edit'])->name('care.care-units.edit');
        Route::put('/care-units/{careUnit}', [CareUnitController::class, 'update'])->name('care.care-units.update');
        Route::delete('/care-units/{careUnit}', [CareUnitController::class, 'destroy'])->name('care.care-units.destroy');
        Route::post('/care-units/{careUnit}/beds', [BedController::class, 'store'])->name('care.care-units.beds.store');
        Route::put('/care-units/{careUnit}/beds/{bed}', [BedController::class, 'update'])->name('care.care-units.beds.update');
        Route::delete('/care-units/{careUnit}/beds/{bed}', [BedController::class, 'destroy'])->name('care.care-units.beds.destroy');
        Route::post('/care-units/{careUnit}/placements', [VisitPlacementController::class, 'store'])->name('care.care-units.placements.store');
        Route::post('/visits/{visit}/placement/transfer', [VisitPlacementController::class, 'transfer'])->name('care.visits.placement.transfer');
        Route::delete('/visits/{visit}/placement', [VisitPlacementController::class, 'destroy'])->name('care.visits.placement.destroy');

        Route::get('/care-units/{careUnit}/mar', [MarController::class, 'unitBoard'])->name('care.care-units.mar');
        Route::get('/visits/{visit}/mar', [MarController::class, 'visitChart'])->name('care.visits.mar');
        Route::post('/mar/orders/{marOrder}/administer', [MarController::class, 'administer'])->name('care.mar.administer');

        Route::get('/care-units/{careUnit}/notes', [NursingDocumentationController::class, 'unitNotes'])->name('care.care-units.notes');
        Route::post('/care-units/{careUnit}/notes', [NursingDocumentationController::class, 'storeNote'])->name('care.care-units.notes.store');
        Route::get('/care-units/{careUnit}/handovers', [NursingDocumentationController::class, 'handovers'])->name('care.care-units.handovers');
        Route::get('/care-units/{careUnit}/handovers/create', [NursingDocumentationController::class, 'createHandover'])->name('care.care-units.handovers.create');
        Route::post('/care-units/{careUnit}/handovers', [NursingDocumentationController::class, 'storeHandover'])->name('care.care-units.handovers.store');
        Route::get('/care-units/{careUnit}/handovers/{wardHandover}', [NursingDocumentationController::class, 'showHandover'])->name('care.care-units.handovers.show');
        Route::post('/care-units/{careUnit}/handovers/{wardHandover}/complete', [NursingDocumentationController::class, 'completeHandover'])->name('care.care-units.handovers.complete');

        Route::get('/care-units/{careUnit}/assessments', [NursingAssessmentController::class, 'unitBoard'])->name('care.care-units.assessments');
        Route::post('/care-units/{careUnit}/visits/{visit}/assessments', [NursingAssessmentController::class, 'start'])->name('care.care-units.assessments.start');
        Route::post('/care-units/{careUnit}/visits/{visit}/vitals', [NursingAssessmentController::class, 'storeVitals'])->name('care.care-units.vitals.store');
        Route::get('/care-units/{careUnit}/performance', [NursePerformanceController::class, 'show'])->name('care.care-units.performance');

        Route::get('/care-units/{careUnit}/roster', [RosterController::class, 'show'])->name('care.care-units.roster');
        Route::post('/care-units/{careUnit}/roster', [RosterController::class, 'store'])->name('care.care-units.roster.store');
        Route::delete('/care-units/{careUnit}/roster/{rosterEntry}', [RosterController::class, 'destroy'])->name('care.care-units.roster.destroy');

        Route::get('/shifts', [ShiftController::class, 'index'])->name('care.shifts.index');
        Route::post('/shifts', [ShiftController::class, 'store'])->name('care.shifts.store');
        Route::put('/shifts/{shift}', [ShiftController::class, 'update'])->name('care.shifts.update');

        Route::get('/nursing/services', [NursingServicesController::class, 'index'])->name('care.nursing.services');
        Route::get('/nursing/station', [NurseStationController::class, 'index'])->name('care.nursing.station');
        Route::get('/my-shifts', [MyShiftsController::class, 'index'])->name('care.my-shifts');

        Route::get('/staff-assignments', [StaffAssignmentController::class, 'index'])->name('care.staff-assignments.index');
        Route::get('/staff-assignments/create', [StaffAssignmentController::class, 'create'])->name('care.staff-assignments.create');
        Route::post('/staff-assignments', [StaffAssignmentController::class, 'store'])->name('care.staff-assignments.store');
        Route::get('/staff-assignments/{staffAssignment}/edit', [StaffAssignmentController::class, 'edit'])->name('care.staff-assignments.edit');
        Route::put('/staff-assignments/{staffAssignment}', [StaffAssignmentController::class, 'update'])->name('care.staff-assignments.update');
        Route::delete('/staff-assignments/{staffAssignment}', [StaffAssignmentController::class, 'destroy'])->name('care.staff-assignments.destroy');

        Route::get('/practitioners', [PractitionerController::class, 'index'])->name('care.practitioners.index');
        Route::get('/practitioners/create', [PractitionerController::class, 'create'])->name('care.practitioners.create');
        Route::post('/practitioners', [PractitionerController::class, 'store'])->name('care.practitioners.store');
        Route::get('/practitioners/{practitioner}/edit', [PractitionerController::class, 'edit'])->name('care.practitioners.edit');
        Route::put('/practitioners/{practitioner}', [PractitionerController::class, 'update'])->name('care.practitioners.update');
        Route::delete('/practitioners/{practitioner}', [PractitionerController::class, 'destroy'])->name('care.practitioners.destroy');

        Route::get('/settings/team', [MemberController::class, 'index'])->name('care.members.index');
        Route::get('/settings/team/create', [MemberController::class, 'create'])->name('care.members.create');
        Route::post('/settings/team', [MemberController::class, 'store'])->name('care.members.store');
        Route::delete('/settings/team/{member}', [MemberController::class, 'destroy'])->name('care.members.destroy');

        Route::redirect('/members', '/settings/team');
        Route::redirect('/members/create', '/settings/team/create');

        Route::get('/audit-logs', [AuditLogController::class, 'index'])->name('care.audit.index');
        Route::get('/audit-logs/export', [AuditLogController::class, 'export'])->name('care.audit.export');

        Route::get('/wallet', fn () => redirect()->away(ladill_account_url('/wallet')))->name('care.wallet');
        Route::get('/team', fn () => redirect()->away(ladill_account_url('/account/team')))->name('care.team');
    });
});
