<?php

/**
 * Specialty practice modules (Settings → Modules).
 * Pro-gated via plans.*.features specialty_modules.
 *
 * Access tiers (RBAC via Care member roles):
 * - general: broad day-to-day access for listed roles (GPs = doctor without specialty desk)
 * - limited: GPs + nurses (and listed roles); desk specialists only when specialty keywords match
 * - restricted: specialist doctors (department / specialty keywords) + optional support_roles;
 *   GPs use view_roles / refer_roles; desk specialists only see matching modules
 *
 * Prefer existing clinical role slugs on allowlists. Dedicated managers (e.g. blood_bank_manager,
 * lab_manager) are intentional product roles — add them to the relevant module roles lists.
 *
 * Desk specialists (doctor whose practitioner specialty matches specialist_keywords, or who is
 * assigned to the module department) only see modules relevant to their work — non-matching
 * modules are access "none" (hidden from sidebar). Nurses / receptionists keep role allowlists.
 *
 * default_on_paid_plans: always on for Pro/Enterprise (sidebar + access).
 *
 * @return array<string, array<string, mixed>>
 */
return [
    'emergency' => [
        'label' => 'Emergency',
        'description' => 'Emergency department triage, resus, and urgent care queues.',
        'department_type' => 'emergency',
        'department_name' => 'Emergency',
        'queue_name' => 'Emergency',
        'queue_prefix' => 'ER',
        'nav_label' => 'Emergency',
        'icon' => 'bolt',
        'queue_keywords' => ['emerg', 'casualty', 'trauma', 'er', 'a&e'],
        'access' => 'general',
        'roles' => ['doctor', 'nurse', 'lab_technician', 'pharmacist', 'receptionist'],
        'default_on_paid_plans' => true,
    ],
    'blood_bank' => [
        'label' => 'Blood Bank',
        'description' => 'Blood products, cross-match requests, and transfusion counters.',
        'department_type' => 'blood_bank',
        'department_name' => 'Blood Bank',
        'queue_name' => 'Blood Bank',
        'queue_prefix' => 'BB',
        'nav_label' => 'Blood Bank',
        'icon' => 'droplet',
        'queue_keywords' => ['blood', 'transfusion', 'crossmatch', 'donor'],
        'access' => 'general',
        'roles' => ['blood_bank_manager', 'lab_technician', 'nurse', 'doctor', 'receptionist'],
        'default_on_paid_plans' => true,
    ],
    'dentistry' => [
        'label' => 'Dentistry',
        'description' => 'Dental chairs, oral consults, and dentistry waiting lists.',
        'department_type' => 'dental',
        'department_name' => 'Dentistry',
        'queue_name' => 'Dentistry',
        'queue_prefix' => 'DEN',
        'nav_label' => 'Dentistry',
        'icon' => 'face-smile',
        'queue_keywords' => ['dent', 'dental', 'oral'],
        'access' => 'limited',
        'roles' => ['doctor', 'nurse', 'receptionist'],
        'specialist_keywords' => ['dent', 'dental', 'oral', 'odont'],
    ],
    'ophthalmology' => [
        'label' => 'Eye care',
        'description' => 'Ophthalmology and optometry clinics with dedicated queues.',
        'department_type' => 'ophthalmology',
        'department_name' => 'Eye care',
        'queue_name' => 'Eye care',
        'queue_prefix' => 'EYE',
        'nav_label' => 'Eye care',
        'icon' => 'eye',
        'queue_keywords' => ['eye', 'ophthal', 'optom'],
        'access' => 'limited',
        'roles' => ['doctor', 'nurse', 'receptionist'],
        'specialist_keywords' => ['eye', 'ophthal', 'optom'],
    ],
    'physiotherapy' => [
        'label' => 'Physiotherapy',
        'description' => 'Rehab sessions and physiotherapy treatment queues.',
        'department_type' => 'physiotherapy',
        'department_name' => 'Physiotherapy',
        'queue_name' => 'Physiotherapy',
        'queue_prefix' => 'PHY',
        'nav_label' => 'Physiotherapy',
        'icon' => 'arrow-path',
        'queue_keywords' => ['physio', 'rehab', 'therapy'],
        'access' => 'limited',
        'roles' => ['doctor', 'nurse', 'receptionist'],
        'specialist_keywords' => ['physio', 'rehab', 'therapy'],
    ],
    'maternity' => [
        'label' => 'Maternity / Antenatal',
        'description' => 'Antenatal clinics, maternity wards, and related queues.',
        'department_type' => 'maternity',
        'department_name' => 'Maternity',
        'queue_name' => 'Maternity',
        'queue_prefix' => 'MAT',
        'nav_label' => 'Maternity',
        'icon' => 'heart',
        'queue_keywords' => ['matern', 'antenatal', 'obstetric'],
        'access' => 'limited',
        'roles' => ['doctor', 'nurse', 'pharmacist', 'receptionist'],
        'specialist_keywords' => ['matern', 'antenatal', 'obstetric', 'midwif'],
    ],
    'radiology' => [
        'label' => 'Radiology',
        'description' => 'Imaging requests and radiology service counters.',
        'department_type' => 'radiology',
        'department_name' => 'Radiology',
        'queue_name' => 'Radiology',
        'queue_prefix' => 'RAD',
        'nav_label' => 'Radiology',
        'icon' => 'camera',
        'queue_keywords' => ['radio', 'imaging', 'x-ray', 'xray', 'ultrasound', 'ct', 'mri'],
        'access' => 'general',
        'roles' => ['doctor', 'nurse', 'lab_technician', 'receptionist'],
        'specialist_keywords' => ['radio', 'radiolog', 'imaging'],
    ],
    'cardiology' => [
        'label' => 'Cardiology',
        'description' => 'Heart clinics, ECG follow-up, and cardiology waiting lists.',
        'department_type' => 'cardiology',
        'department_name' => 'Cardiology',
        'queue_name' => 'Cardiology',
        'queue_prefix' => 'CAR',
        'nav_label' => 'Cardiology',
        'icon' => 'heart',
        'queue_keywords' => ['cardio', 'heart', 'ecg', 'echo'],
        'access' => 'restricted',
        'roles' => ['doctor'],
        'support_roles' => ['nurse'],
        'view_roles' => ['doctor', 'nurse', 'lab_technician'],
        'refer_roles' => ['doctor', 'nurse'],
        'specialist_keywords' => ['cardio', 'cardiology', 'heart', 'ecg'],
    ],
    'psychiatry' => [
        'label' => 'Psychiatry',
        'description' => 'Mental health consultations and psychiatry clinic queues.',
        'department_type' => 'psychiatry',
        'department_name' => 'Psychiatry',
        'queue_name' => 'Psychiatry',
        'queue_prefix' => 'PSY',
        'nav_label' => 'Psychiatry',
        'icon' => 'chat-bubble-left-right',
        'queue_keywords' => ['psych', 'mental', 'behaviour'],
        'access' => 'restricted',
        'roles' => ['doctor'],
        'support_roles' => ['nurse'],
        'view_roles' => ['doctor', 'nurse'],
        'refer_roles' => ['doctor', 'nurse'],
        'specialist_keywords' => ['psych', 'psychiatry', 'mental', 'behaviour'],
    ],
    'pediatrics' => [
        'label' => 'Pediatrics',
        'description' => 'Child health clinics and pediatric consultation queues.',
        'department_type' => 'pediatrics',
        'department_name' => 'Pediatrics',
        'queue_name' => 'Pediatrics',
        'queue_prefix' => 'PED',
        'nav_label' => 'Pediatrics',
        'icon' => 'user-group',
        'queue_keywords' => ['pedia', 'paedia', 'child', 'infant'],
        'access' => 'general',
        'roles' => ['doctor', 'nurse', 'receptionist'],
    ],
    'orthopedics' => [
        'label' => 'Orthopedics',
        'description' => 'Bones, joints, fracture clinics, and orthopedic queues.',
        'department_type' => 'orthopedics',
        'department_name' => 'Orthopedics',
        'queue_name' => 'Orthopedics',
        'queue_prefix' => 'ORT',
        'nav_label' => 'Orthopedics',
        'icon' => 'cube',
        'queue_keywords' => ['ortho', 'fracture', 'bone', 'joint'],
        'access' => 'restricted',
        'roles' => ['doctor'],
        'support_roles' => [],
        'view_roles' => ['doctor', 'nurse'],
        'refer_roles' => ['doctor', 'nurse'],
        'specialist_keywords' => ['ortho', 'orthopedic', 'orthopaedic', 'fracture'],
    ],
    'ent' => [
        'label' => 'ENT',
        'description' => 'Ear, nose, and throat clinics with dedicated queues.',
        'department_type' => 'ent',
        'department_name' => 'ENT',
        'queue_name' => 'ENT',
        'queue_prefix' => 'ENT',
        'nav_label' => 'ENT',
        'icon' => 'speaker-wave',
        'queue_keywords' => ['ent', 'ear', 'nose', 'throat', 'otolaryng'],
        'access' => 'restricted',
        'roles' => ['doctor'],
        'support_roles' => [],
        'view_roles' => ['doctor', 'nurse'],
        'refer_roles' => ['doctor', 'nurse'],
        'specialist_keywords' => ['ent', 'otolaryng', 'ear', 'nose', 'throat'],
    ],
    'oncology' => [
        'label' => 'Oncology',
        'description' => 'Cancer care clinics, chemo day-care, and oncology queues.',
        'department_type' => 'oncology',
        'department_name' => 'Oncology',
        'queue_name' => 'Oncology',
        'queue_prefix' => 'ONC',
        'nav_label' => 'Oncology',
        'icon' => 'shield-exclamation',
        'queue_keywords' => ['oncol', 'cancer', 'chemo'],
        'access' => 'restricted',
        'roles' => ['doctor'],
        'support_roles' => ['nurse'],
        'view_roles' => ['doctor', 'nurse', 'pharmacist'],
        'refer_roles' => ['doctor', 'nurse'],
        'specialist_keywords' => ['oncol', 'cancer', 'chemo'],
    ],
    'renal' => [
        'label' => 'Renal Care',
        'description' => 'Dialysis, nephrology clinics, and renal care queues.',
        'department_type' => 'renal',
        'department_name' => 'Renal Care',
        'queue_name' => 'Renal Care',
        'queue_prefix' => 'REN',
        'nav_label' => 'Renal Care',
        'icon' => 'circle-stack',
        'queue_keywords' => ['renal', 'dialysis', 'nephro', 'kidney'],
        'access' => 'restricted',
        'roles' => ['doctor'],
        'support_roles' => ['nurse'],
        'view_roles' => ['doctor', 'nurse'],
        'refer_roles' => ['doctor', 'nurse'],
        'specialist_keywords' => ['renal', 'nephro', 'dialysis', 'kidney'],
    ],
    'surgery' => [
        'label' => 'Surgery',
        'description' => 'Surgical OPD, pre-op assessment, and theatre-linked queues.',
        'department_type' => 'surgery',
        'department_name' => 'Surgery',
        'queue_name' => 'Surgery',
        'queue_prefix' => 'SUR',
        'nav_label' => 'Surgery',
        'icon' => 'wrench-screwdriver',
        'queue_keywords' => ['surg', 'theatre', 'operat', 'pre-op'],
        'access' => 'restricted',
        'roles' => ['doctor'],
        'support_roles' => ['nurse'],
        'view_roles' => ['doctor', 'nurse'],
        'refer_roles' => ['doctor', 'nurse'],
        'specialist_keywords' => ['surg', 'theatre', 'operat'],
    ],
    'vaccination' => [
        'label' => 'Vaccination & Immunization',
        'description' => 'Immunization clinics, EPI schedules, and vaccine queues.',
        'department_type' => 'vaccination',
        'department_name' => 'Vaccination',
        'queue_name' => 'Vaccination',
        'queue_prefix' => 'VAX',
        'nav_label' => 'Vaccination',
        'icon' => 'shield-check',
        'queue_keywords' => ['vaccin', 'immun', 'epi', 'injection'],
        'access' => 'general',
        'roles' => ['doctor', 'nurse', 'receptionist'],
    ],
    'pathology' => [
        'label' => 'Pathology',
        'description' => 'Histopathology, cytology, and pathology service counters.',
        'department_type' => 'pathology',
        'department_name' => 'Pathology',
        'queue_name' => 'Pathology',
        'queue_prefix' => 'PATH',
        'nav_label' => 'Pathology',
        'icon' => 'document-magnifying-glass',
        'queue_keywords' => ['pathol', 'histo', 'cytol', 'biopsy'],
        'access' => 'general',
        'roles' => ['lab_technician', 'doctor', 'nurse', 'receptionist'],
        'specialist_keywords' => ['pathol', 'histo', 'cytol'],
    ],
    'infusion' => [
        'label' => 'Infusion Centre',
        'description' => 'IV therapy, infusion chairs, and day-care infusion queues.',
        'department_type' => 'infusion',
        'department_name' => 'Infusion Centre',
        'queue_name' => 'Infusion',
        'queue_prefix' => 'INF',
        'nav_label' => 'Infusion',
        'icon' => 'beaker',
        'queue_keywords' => ['infusion', 'iv', 'drip', 'day care'],
        'access' => 'general',
        'roles' => ['doctor', 'nurse', 'pharmacist', 'receptionist'],
    ],
    'dermatology' => [
        'label' => 'Dermatology',
        'description' => 'Skin clinics, dermatology procedures, and specialty queues.',
        'department_type' => 'dermatology',
        'department_name' => 'Dermatology',
        'queue_name' => 'Dermatology',
        'queue_prefix' => 'DER',
        'nav_label' => 'Dermatology',
        'icon' => 'swatch',
        'queue_keywords' => ['derma', 'skin', 'rash'],
        'access' => 'restricted',
        'roles' => ['doctor'],
        'support_roles' => [],
        'view_roles' => ['doctor', 'nurse'],
        'refer_roles' => ['doctor', 'nurse'],
        'specialist_keywords' => ['derma', 'skin'],
    ],
    'podiatry' => [
        'label' => 'Podiatry',
        'description' => 'Foot clinics, diabetic foot care, and podiatry queues.',
        'department_type' => 'podiatry',
        'department_name' => 'Podiatry',
        'queue_name' => 'Podiatry',
        'queue_prefix' => 'POD',
        'nav_label' => 'Podiatry',
        'icon' => 'finger-print',
        'queue_keywords' => ['podiat', 'foot', 'diabetic foot'],
        'access' => 'restricted',
        'roles' => ['doctor'],
        'support_roles' => [],
        'view_roles' => ['doctor', 'nurse'],
        'refer_roles' => ['doctor', 'nurse'],
        'specialist_keywords' => ['podiat', 'foot'],
    ],
    'fertility' => [
        'label' => 'Fertility',
        'description' => 'Fertility / IVF clinics and reproductive health queues.',
        'department_type' => 'fertility',
        'department_name' => 'Fertility',
        'queue_name' => 'Fertility',
        'queue_prefix' => 'FER',
        'nav_label' => 'Fertility',
        'icon' => 'sparkles',
        'queue_keywords' => ['fertil', 'ivf', 'reproduct'],
        'access' => 'restricted',
        'roles' => ['doctor'],
        'support_roles' => [],
        'view_roles' => ['doctor', 'nurse'],
        'refer_roles' => ['doctor', 'nurse'],
        'specialist_keywords' => ['fertil', 'ivf', 'reproduct'],
    ],
    'child_welfare' => [
        'label' => 'Child Welfare Clinic',
        'description' => 'Well-child visits, growth monitoring, and CWC queues.',
        'department_type' => 'child_welfare',
        'department_name' => 'Child Welfare Clinic',
        'queue_name' => 'Child Welfare',
        'queue_prefix' => 'CWC',
        'nav_label' => 'Child Welfare',
        'icon' => 'gift',
        'queue_keywords' => ['cwc', 'child welfare', 'well baby', 'growth'],
        'access' => 'general',
        'roles' => ['doctor', 'nurse', 'receptionist'],
    ],
];
