import { IMAGING_AREA_TYPES, REFERENCE_TYPES } from '@tamanu/constants';
import { ALLERGIES } from '@tamanu/database/demoData/allergies';
import { APPOINTMENT_TYPES } from '@tamanu/database/demoData/appointmentTypes';
import { CARE_PLANS } from '@tamanu/database/demoData/carePlan';
import { DIAGNOSES } from '@tamanu/database/demoData/diagnoses';
import { DISPOSITIONS } from '@tamanu/database/demoData/dispositions';
import { DRUGS } from '@tamanu/database/demoData/drugs';
import { LAB_SAMPLE_SITES } from '@tamanu/database/demoData/labSampleSites';
import { PROCEDURE_TYPES } from '@tamanu/database/demoData/procedureTypes';
import { SPECIMEN_TYPES } from '@tamanu/database/demoData/specimenTypes';
import { TRIAGE_DIAGNOSES } from '@tamanu/database/demoData/triageDiagnoses';
import { VILLAGES } from '@tamanu/database/demoData/villages';
import {
  CT_SCAN_IMAGING_AREAS,
  ULTRASOUND_IMAGING_AREAS,
  X_RAY_IMAGING_AREAS,
} from '@tamanu/database/demoData/imagingAreas';

type NamedDemoRecord = { name: string };

const names = (records: NamedDemoRecord[]) => records.map(({ name }) => name);
// DIAGNOSES and PROCEDURE_TYPES store name and code in one tab-separated string.
const namesBeforeTab = (records: NamedDemoRecord[]) =>
  records.map(({ name }) => name.split('\t')[0]);
const namesAfterTab = (records: NamedDemoRecord[]) =>
  records.map(({ name }) => name.split('\t')[1] ?? name);

// Covers the imaging area types with no demo data list of their own.
const GENERIC_IMAGING_AREA_NAMES = [
  'Head',
  'Neck',
  'Chest',
  'Abdomen',
  'Pelvis',
  'Spine',
  'Left shoulder',
  'Right shoulder',
  'Left knee',
  'Right knee',
  'Left hand',
  'Right hand',
  'Left foot',
  'Right foot',
  'Whole body',
];

export const REFERENCE_DATA_NAMES: Record<string, string[]> = {
  [REFERENCE_TYPES.ALLERGY]: names(ALLERGIES),
  [REFERENCE_TYPES.APPOINTMENT_TYPE]: names(APPOINTMENT_TYPES),
  [REFERENCE_TYPES.CARE_PLAN]: names(CARE_PLANS),
  [REFERENCE_TYPES.DIAGNOSIS]: namesBeforeTab(DIAGNOSES),
  [REFERENCE_TYPES.DISCHARGE_DISPOSITION]: names(DISPOSITIONS),
  [REFERENCE_TYPES.DRUG]: names(DRUGS),
  [REFERENCE_TYPES.LAB_SAMPLE_SITE]: names(LAB_SAMPLE_SITES),
  [REFERENCE_TYPES.PROCEDURE_TYPE]: namesAfterTab(PROCEDURE_TYPES),
  [REFERENCE_TYPES.SPECIMEN_TYPE]: names(SPECIMEN_TYPES),
  [REFERENCE_TYPES.TRIAGE_REASON]: names(TRIAGE_DIAGNOSES),
  [REFERENCE_TYPES.VILLAGE]: names(VILLAGES),
  [IMAGING_AREA_TYPES.CT_SCAN_IMAGING_AREA]: names(CT_SCAN_IMAGING_AREAS),
  [IMAGING_AREA_TYPES.ULTRASOUND_IMAGING_AREA]: names(ULTRASOUND_IMAGING_AREAS),
  [IMAGING_AREA_TYPES.X_RAY_IMAGING_AREA]: names(X_RAY_IMAGING_AREAS),

  [REFERENCE_TYPES.ARRIVAL_MODE]: [
    'Ambulance',
    'Walk-in',
    'Private vehicle',
    'Police',
    'Air ambulance',
    'Boat',
    'Inter-facility transfer',
    'Community health worker',
  ],
  [REFERENCE_TYPES.BOOKING_TYPE]: [
    'Standard consultation',
    'Extended consultation',
    'Day procedure',
    'Follow-up review',
    'Telehealth',
    'Home visit',
    'Outreach clinic',
  ],
  [REFERENCE_TYPES.CATCHMENT]: [
    'Northern Catchment',
    'Southern Catchment',
    'Eastern Catchment',
    'Western Catchment',
    'Central Catchment',
    'Coastal Catchment',
    'Highlands Catchment',
    'Islands Catchment',
  ],
  [REFERENCE_TYPES.CONTACT_RELATIONSHIP]: [
    'Spouse',
    'Parent',
    'Child',
    'Sibling',
    'Grandparent',
    'Guardian',
    'Aunt or uncle',
    'Cousin',
    'Neighbour',
    'Friend',
  ],
  [REFERENCE_TYPES.COUNTRY]: [
    'Australia',
    'Fiji',
    'Kiribati',
    'Nauru',
    'New Zealand',
    'Papua New Guinea',
    'Samoa',
    'Solomon Islands',
    'Tonga',
    'Tuvalu',
    'Vanuatu',
  ],
  [REFERENCE_TYPES.DESIGNATION]: [
    'Registered Nurse',
    'Enrolled Nurse',
    'Nurse Practitioner',
    'Midwife',
    'Medical Officer',
    'Senior Medical Officer',
    'Surgeon',
    'Anaesthetist',
    'Paediatrician',
    'Pharmacist',
    'Laboratory Technician',
    'Radiographer',
    'Community Health Worker',
    'Ward Clerk',
  ],
  [REFERENCE_TYPES.DIET]: [
    'Full ward diet',
    'Soft diet',
    'Pureed diet',
    'Fluids only',
    'Nil by mouth',
    'Diabetic diet',
    'Low salt',
    'Low protein',
    'High protein',
    'Gluten free',
    'Infant formula',
  ],
  [REFERENCE_TYPES.DISEASE_CODING]: ['ICD-10', 'ICD-11', 'SNOMED CT', 'ICPC-2', 'Local coding'],
  [REFERENCE_TYPES.DIVISION]: [
    'Northern Division',
    'Southern Division',
    'Eastern Division',
    'Western Division',
    'Central Division',
    'Highlands Division',
    'Islands Division',
    'Coastal Division',
  ],
  [REFERENCE_TYPES.ENCOUNTER_FEE]: [
    'Clinic consultation - standard',
    'Clinic consultation - after hours',
    'Clinic consultation - weekend',
    'Emergency attendance - standard',
    'Emergency attendance - after hours',
    'Emergency attendance - weekend',
  ],
  [REFERENCE_TYPES.ETHNICITY]: [
    'Melanesian',
    'Polynesian',
    'Micronesian',
    'Papuan',
    'Chinese',
    'European',
    'Indian',
    'Filipino',
    'Mixed heritage',
  ],
  [REFERENCE_TYPES.FAMILY_RELATION]: [
    'Mother',
    'Father',
    'Daughter',
    'Son',
    'Sister',
    'Brother',
    'Grandmother',
    'Grandfather',
    'Aunt',
    'Uncle',
  ],
  [REFERENCE_TYPES.IMAGING_TYPE]: [
    'X-Ray',
    'CT Scan',
    'Ultrasound',
    'MRI',
    'Mammogram',
    'ECG',
    'Echocardiogram',
    'Endoscopy',
    'Colonoscopy',
    'Angiogram',
  ],
  [REFERENCE_TYPES.INSURER]: [
    'National Health Insurance',
    'Public Service Scheme',
    'Pacific Health Cover',
    'Island Mutual',
    'Seafarers Fund',
    'Teachers Health Fund',
    'Veterans Scheme',
  ],
  [REFERENCE_TYPES.LAB_TEST_CATEGORY]: [
    'Haematology',
    'Biochemistry',
    'Microbiology',
    'Serology',
    'Urinalysis',
    'Parasitology',
    'Immunology',
    'Cytology',
  ],
  [REFERENCE_TYPES.LAB_TEST_LABORATORY]: [
    'Central Public Health Laboratory',
    'National Referral Laboratory',
    'Provincial Hospital Laboratory',
    'District Laboratory',
    'Mobile Testing Unit',
    'Partner Reference Laboratory',
  ],
  [REFERENCE_TYPES.LAB_TEST_METHOD]: [
    'Microscopy',
    'Culture',
    'Rapid diagnostic test',
    'PCR',
    'ELISA',
    'Immunoassay',
    'Spectrophotometry',
    'Flow cytometry',
  ],
  [REFERENCE_TYPES.LAB_TEST_PRIORITY]: ['Routine', 'Urgent', 'STAT', 'Pre-admission', 'Add-on'],
  [REFERENCE_TYPES.MANUFACTURER]: [
    'Serum Institute',
    'Bio Farma',
    'Sanofi Pasteur',
    'GlaxoSmithKline',
    'Pfizer',
    'Moderna',
    'Sinovac',
    'Bharat Biotech',
  ],
  [REFERENCE_TYPES.MEDICAL_AREA]: [
    'General Medicine',
    'Paediatrics',
    'Obstetrics',
    'Surgery',
    'Emergency',
    'Oncology',
    'Cardiology',
    'Renal',
    'Mental Health',
    'Rehabilitation',
  ],
  [REFERENCE_TYPES.MEDICATION_DISPENSE_MODIFY_REASON]: [
    'Out of stock',
    'Substituted with generic',
    'Partial supply only',
    'Dose adjusted by pharmacist',
    'Pack size differs',
    'Prescriber contacted',
  ],
  [REFERENCE_TYPES.MEDICATION_NOT_GIVEN_REASON]: [
    'Patient refused',
    'Patient absent',
    'Nil by mouth',
    'Out of stock',
    'Vomiting',
    'Adverse reaction',
    'Withheld by clinician',
    'Dose already given',
  ],
  [REFERENCE_TYPES.MEDICATION_PRESET_LABEL]: [
    'Post-operative analgesia',
    'Antenatal supplements',
    'Malaria treatment',
    'TB continuation phase',
    'Diabetes maintenance',
    'Hypertension maintenance',
    'Paediatric fever',
  ],
  [REFERENCE_TYPES.MEDICATION_SET]: [
    'Antenatal care set',
    'Emergency trolley set',
    'Post-operative set',
    'Paediatric ward set',
    'Malaria protocol set',
    'TB protocol set',
  ],
  [REFERENCE_TYPES.MEDICATION_TEMPLATE]: [
    'Paracetamol 500mg oral',
    'Amoxicillin 250mg oral',
    'Metformin 500mg oral',
    'Amlodipine 5mg oral',
    'Ceftriaxone 1g IV',
    'Ferrous sulfate 200mg oral',
    'Salbutamol inhaler',
    'Ondansetron 4mg IV',
  ],
  [REFERENCE_TYPES.NATIONALITY]: [
    'Australian',
    'Fijian',
    'I-Kiribati',
    'Nauruan',
    'New Zealander',
    'Papua New Guinean',
    'Samoan',
    'Solomon Islander',
    'Tongan',
    'Tuvaluan',
    'Ni-Vanuatu',
  ],
  [REFERENCE_TYPES.NOTE_TYPE]: [
    'Treatment plan',
    'Admission',
    'Discharge planning',
    'Clinical mobility',
    'Dietary',
    'Handover',
    'Nursing',
    'Pharmacy',
    'Physiotherapy',
    'Social welfare',
  ],
  [REFERENCE_TYPES.NURSING_ZONE]: [
    'Zone A',
    'Zone B',
    'Zone C',
    'North Wing',
    'South Wing',
    'Maternity Zone',
    'Paediatric Zone',
    'Critical Care Zone',
  ],
  [REFERENCE_TYPES.OCCUPATION]: [
    'Farmer',
    'Fisher',
    'Teacher',
    'Nurse',
    'Driver',
    'Shopkeeper',
    'Carpenter',
    'Police officer',
    'Public servant',
    'Student',
    'Homemaker',
    'Retired',
    'Unemployed',
  ],
  [REFERENCE_TYPES.PATIENT_BILLING_TYPE]: [
    'Public patient',
    'Private patient',
    'Insured',
    'Overseas visitor',
    'Staff',
    'Exempt',
  ],
  [REFERENCE_TYPES.PAYMENT_METHOD]: [
    'Cash',
    'Card',
    'Bank transfer',
    'Mobile money',
    'Cheque',
    'Insurance claim',
    'Waived',
  ],
  [REFERENCE_TYPES.PHARMACY_ENCOUNTER_FEE]: [
    'Pharmacy dispensing fee',
    'Pharmacy consultation fee',
    'Pharmacy after hours fee',
  ],
  [REFERENCE_TYPES.PLACE_OF_BIRTH]: [
    'Born in facility',
    'Born before arrival',
    'Born at home',
    'Born in transit',
    'Born overseas',
  ],
  [REFERENCE_TYPES.REACTION]: [
    'Rash',
    'Hives',
    'Itching',
    'Swelling',
    'Anaphylaxis',
    'Nausea',
    'Vomiting',
    'Diarrhoea',
    'Shortness of breath',
    'Wheezing',
  ],
  [REFERENCE_TYPES.REFERRAL_SOURCE]: [
    'Self-referral',
    'General practitioner',
    'Community health worker',
    'Aid post',
    'District hospital',
    'Specialist clinic',
    'School health programme',
    'Outreach team',
  ],
  [REFERENCE_TYPES.RELIGION]: [
    'Catholic',
    'Lutheran',
    'United Church',
    'Seventh Day Adventist',
    'Anglican',
    'Pentecostal',
    'Baptist',
    'Evangelical',
    'Muslim',
    'Hindu',
    'None',
  ],
  [REFERENCE_TYPES.SECONDARY_ID_TYPE]: [
    'Passport',
    'Driving licence',
    'Birth certificate',
    'Voter card',
    'National ID',
    'Health card',
  ],
  [REFERENCE_TYPES.SETTLEMENT]: [
    'Riverside Settlement',
    'Hilltop Settlement',
    'Seaside Settlement',
    'Old Town',
    'New Town',
    'Market Ward',
    'Mission Station',
    'Airport Camp',
  ],
  [REFERENCE_TYPES.SUBDIVISION]: [
    'Kairuku District',
    'Rigo District',
    'Abau District',
    'Goilala District',
    'North Coast',
    'South Coast',
    'Upper Valley',
    'Lower Valley',
  ],
  [REFERENCE_TYPES.TASK_DELETION_REASON]: [
    'Entered in error',
    'Duplicate task',
    'Order cancelled',
    'Patient discharged',
    'Patient transferred',
    'No longer clinically indicated',
  ],
  [REFERENCE_TYPES.TASK_NOT_COMPLETED_REASON]: [
    'Patient refused',
    'Patient absent',
    'Patient asleep',
    'Equipment unavailable',
    'Staff unavailable',
    'Clinically deferred',
    'Patient off ward',
  ],
  [REFERENCE_TYPES.TASK_SET]: [
    'Admission observations',
    'Post-operative observations',
    'Antenatal observations',
    'Neurological observations',
    'Diabetic ward round',
    'Discharge checklist',
  ],
  [REFERENCE_TYPES.TASK_TEMPLATE]: [
    'Blood pressure check',
    'Temperature check',
    'Wound dressing change',
    'IV cannula check',
    'Catheter care',
    'Pressure area care',
    'Blood glucose check',
    'Fluid balance chart',
    'Medication round',
    'Mobilise patient',
  ],
  [REFERENCE_TYPES.VACCINE_CIRCUMSTANCE]: [
    'Routine schedule',
    'Catch-up',
    'Outbreak response',
    'Travel',
    'Occupational',
    'Campaign',
  ],
  [REFERENCE_TYPES.VACCINE_NOT_GIVEN_REASON]: [
    'Vaccine out of stock',
    'Patient unwell',
    'Parent refused',
    'Patient refused',
    'Contraindicated',
    'Cold chain failure',
    'Already vaccinated elsewhere',
  ],
};

for (const areaType of Object.values(IMAGING_AREA_TYPES)) {
  REFERENCE_DATA_NAMES[areaType] ??= GENERIC_IMAGING_AREA_NAMES;
}

export const VACCINES = [
  { label: 'BCG', brand: 'BCG-SSI', disease: 'Tuberculosis' },
  { label: 'Hepatitis B', brand: 'Euvax B', disease: 'Hepatitis B' },
  { label: 'OPV', brand: 'bOPV', disease: 'Poliomyelitis' },
  { label: 'IPV', brand: 'Imovax Polio', disease: 'Poliomyelitis' },
  { label: 'DTP', brand: 'Infanrix hexa', disease: 'Diphtheria, tetanus and pertussis' },
  { label: 'Measles', brand: 'Rouvax', disease: 'Measles' },
  { label: 'MMR', brand: 'Priorix', disease: 'Measles, mumps and rubella' },
  { label: 'Tetanus', brand: 'Tetavax', disease: 'Tetanus' },
  { label: 'Pneumococcal', brand: 'Prevenar 13', disease: 'Pneumococcal disease' },
  { label: 'Rotavirus', brand: 'Rotarix', disease: 'Rotavirus gastroenteritis' },
  { label: 'HPV', brand: 'Gardasil 9', disease: 'Human papillomavirus' },
  { label: 'Yellow Fever', brand: 'Stamaril', disease: 'Yellow fever' },
  { label: 'Typhoid', brand: 'Typhim Vi', disease: 'Typhoid fever' },
  { label: 'Influenza', brand: 'Fluarix Tetra', disease: 'Influenza' },
  { label: 'Varicella', brand: 'Varivax', disease: 'Chickenpox' },
  { label: 'Hepatitis A', brand: 'Havrix', disease: 'Hepatitis A' },
  { label: 'Meningococcal', brand: 'Nimenrix', disease: 'Meningococcal disease' },
  { label: 'Japanese Encephalitis', brand: 'Imojev', disease: 'Japanese encephalitis' },
  { label: 'COVID-19', brand: 'Comirnaty', disease: 'COVID-19' },
];

export const SCHEDULED_VACCINE_LABELS = VACCINES.map(({ label }) => label);

export const SCHEDULED_VACCINE_DOSE_LABELS = [
  'Dose 1',
  'Dose 2',
  'Dose 3',
  'Dose 4',
  'Booster',
  'Birth dose',
  'Annual',
];

export const SURVEY_NAMES = [
  'Maternal Health Assessment',
  'Nutrition Screening',
  'Mental Health Questionnaire',
  'Chronic Disease Follow-up',
  'Community Health Survey',
  'Immunisation Checklist',
  'Antenatal Care Visit',
  'Postnatal Care Assessment',
  'TB Screening Form',
  'Malaria Case Investigation',
  'NCD Risk Assessment',
  'Child Growth Monitoring',
  'Family Planning Counselling',
  'HIV Testing & Counselling',
  'Outbreak Investigation Form',
  'Patient Discharge Summary',
];

export const SURVEY_SCREEN_COMPONENT_PROMPTS = [
  { text: 'Systolic blood pressure (mmHg)', detail: 'Measure after 5 min rest, use left arm' },
  { text: 'Diastolic blood pressure (mmHg)', detail: 'Record seated reading' },
  { text: 'Temperature (°C)', detail: 'Use tympanic or oral thermometer' },
  { text: 'Weight (kg)', detail: 'Remove shoes and heavy clothing' },
  { text: 'Height (cm)', detail: 'Patient should be standing straight' },
  { text: 'Heart rate (bpm)', detail: 'Count for 60 seconds at radial pulse' },
  { text: 'Respiratory rate', detail: 'Count breaths per minute at rest' },
  { text: 'Oxygen saturation (%)', detail: 'Use pulse oximeter on index finger' },
  { text: 'Blood glucose (mmol/L)', detail: 'Record fasting or random, note which' },
  { text: 'MUAC (cm)', detail: 'Mid-upper arm circumference, left arm' },
  { text: 'Pain score (0-10)', detail: '0 = no pain, 10 = worst imaginable' },
  { text: 'Urine dipstick result', detail: 'Record protein, glucose, blood, leukocytes' },
  { text: 'Fundal height (cm)', detail: 'Measure from pubic symphysis' },
  { text: 'Oedema', detail: 'Check ankles, shins, and sacral area' },
  { text: 'Clinical notes', detail: 'Free text observations' },
  { text: 'Presenting complaint', detail: "Chief complaint in patient's own words" },
];

export const PROGRAM_DATA_ELEMENTS = [
  { name: 'Systolic Blood Pressure', indicator: 'Vital Signs' },
  { name: 'Diastolic Blood Pressure', indicator: 'Vital Signs' },
  { name: 'Body Temperature', indicator: 'Vital Signs' },
  { name: 'Respiratory Rate', indicator: 'Vital Signs' },
  { name: 'Oxygen Saturation', indicator: 'Vital Signs' },
  { name: 'Pulse Rate', indicator: 'Vital Signs' },
  { name: 'Body Weight', indicator: 'Anthropometry' },
  { name: 'Body Height', indicator: 'Anthropometry' },
  { name: 'BMI', indicator: 'Anthropometry' },
  { name: 'MUAC', indicator: 'Anthropometry' },
  { name: 'Head Circumference', indicator: 'Anthropometry' },
  { name: 'Haemoglobin Level', indicator: 'Lab Results' },
  { name: 'Blood Glucose', indicator: 'Lab Results' },
  { name: 'Malaria RDT Result', indicator: 'Lab Results' },
  { name: 'HIV Test Result', indicator: 'Lab Results' },
  { name: 'Urine Protein', indicator: 'Lab Results' },
  { name: 'Cough Duration', indicator: 'Symptoms' },
  { name: 'Fever Duration', indicator: 'Symptoms' },
  { name: 'Pain Score', indicator: 'Symptoms' },
  { name: 'Nausea Severity', indicator: 'Symptoms' },
  { name: 'Pregnancy Status', indicator: 'Reproductive Health' },
  { name: 'Gestational Age', indicator: 'Reproductive Health' },
  { name: 'Fundal Height', indicator: 'Reproductive Health' },
  { name: 'Gravidity', indicator: 'Reproductive Health' },
];

export const PROGRAM_DATA_ELEMENT_HINTS = [
  'Enter measured value',
  'Select from options below',
  'Record observation here',
  'Measured at time of visit',
  'Ask patient directly',
  'Refer to lab slip',
  'Use standard equipment',
];

export const PROGRAM_NAMES = [
  'Malaria Control Program',
  'Maternal Health Program',
  'Tuberculosis Program',
  'HIV/AIDS Program',
  'Child Health Program',
  'Nutrition Program',
  'Non-Communicable Disease Program',
  'Expanded Programme on Immunization',
  'Reproductive Health Program',
  'Mental Health Program',
  'Neglected Tropical Diseases Program',
  'Water & Sanitation Program',
  'Community Health Worker Program',
  'Outbreak Surveillance Program',
];

export const PROGRAM_REGISTRY_NAMES = [
  'Tuberculosis Registry',
  'HIV Care Registry',
  'Diabetes Registry',
  'Hypertension Registry',
  'Antenatal Registry',
  'Child Nutrition Registry',
  'Leprosy Registry',
  'Cervical Cancer Screening Registry',
  'Mental Health Registry',
  'Rheumatic Heart Disease Registry',
  'Chronic Kidney Disease Registry',
  'Immunisation Defaulter Registry',
];

export const PROGRAM_REGISTRY_CONDITION_NAMES = [
  'Pulmonary TB',
  'Extrapulmonary TB',
  'Type 1 Diabetes',
  'Type 2 Diabetes',
  'Gestational Diabetes',
  'Stage 1 Hypertension',
  'Stage 2 Hypertension',
  'Asthma',
  'Chronic Kidney Disease',
  'Rheumatic Heart Disease',
  'Severe Acute Malnutrition',
  'Depression',
];

export const PROGRAM_REGISTRY_CLINICAL_STATUS_NAMES = [
  'Newly diagnosed',
  'On treatment',
  'Treatment complete',
  'Lost to follow-up',
  'Transferred out',
  'In remission',
  'Relapsed',
  'Under review',
];

export const DEPARTMENT_NAMES = [
  'Emergency',
  'General Medicine',
  'Surgical',
  'Paediatrics',
  'Obstetrics & Gynaecology',
  'Outpatients',
  'Renal',
  'Oncology',
  'Radiology',
  'Laboratory',
  'Pharmacy',
  'Physiotherapy',
  'Mental Health',
  'Intensive Care',
];

export const LOCATION_GROUP_NAMES = [
  'Ward A',
  'Ward B',
  'Emergency Department',
  'Maternity Ward',
  'Paediatric Ward',
  'Surgical Ward',
  'Intensive Care Unit',
  'Outpatient Clinic',
  'Day Procedure Unit',
  'Isolation Unit',
];

export const LOCATION_NAMES = [
  'Bed 1',
  'Bed 2',
  'Bed 3',
  'Bed 4',
  'Bed 5',
  'Bed 6',
  'Resuscitation Bay',
  'Treatment Room 1',
  'Treatment Room 2',
  'Consult Room 1',
  'Consult Room 2',
  'Triage Bay',
  'Recovery Bay',
  'Isolation Room',
];

const REPORT_TOPICS = [
  'Encounter Summary',
  'Patient Registrations',
  'Vaccination Coverage',
  'Lab Turnaround Times',
  'Outstanding Imaging Requests',
  'Antenatal Visit Compliance',
  'Medication Dispensing Summary',
  'Admissions by Diagnosis',
  'Deaths by Cause',
  'Task Completion Rates',
  'Bed Occupancy',
  'Referral Outcomes',
  'Program Registry Activity',
  'Outpatient Attendance',
];

const REPORT_PERIODS = ['Daily', 'Weekly', 'Monthly', 'Quarterly', 'Annual'];

const REPORT_SCOPES = [
  'National',
  'Northern Division',
  'Southern Division',
  'Eastern Division',
  'Western Division',
  'Central Division',
  'Highlands Division',
  'Islands Division',
  'Coastal Division',
  'Referral Hospitals',
];

// report_definitions.name is unique, and a seed run creates hundreds of them.
export const REPORT_DEFINITION_NAMES = REPORT_TOPICS.flatMap(topic =>
  REPORT_PERIODS.flatMap(period => REPORT_SCOPES.map(scope => `${topic} - ${period} - ${scope}`)),
);

export const INVOICE_PRODUCT_NAMES = [
  'Standard consultation',
  'Specialist consultation',
  'Ward bed day',
  'Theatre fee',
  'Chest X-Ray',
  'Ultrasound scan',
  'Full blood count',
  'Malaria rapid test',
  'Dressing pack',
  'Ambulance transfer',
  'Dispensing fee',
  'Physiotherapy session',
];

export const NOTE_CONTENTS = [
  'Reviewed on ward round, observations stable.',
  'Complains of ongoing pain, analgesia given.',
  'Wound reviewed, healing well, dressing changed.',
  'Family updated on plan of care.',
  'Awaiting lab results before next review.',
  'Tolerating oral intake, IV fluids stopped.',
  'Mobilising independently, physiotherapy to continue.',
  'Afebrile overnight, antibiotics continued.',
  'Discussed discharge planning with patient.',
  'Referred to outpatient clinic for follow-up.',
  'Medication chart reviewed, no changes required.',
  'Patient declined further investigation today.',
  'Vitals within normal range, no acute concerns.',
  'Handover given to incoming shift.',
];

export const PROCEDURE_NOTES = [
  'Local anaesthetic used',
  'Consent obtained prior to procedure',
  'Sterile technique maintained throughout',
  'Patient positioned supine',
  'Antibiotic prophylaxis given',
];

export const PROCEDURE_COMPLETED_NOTES = [
  'Completed without complication',
  'Patient tolerated procedure well',
  'Minor bleeding controlled',
  'Wound closed and dressed',
  'Transferred to recovery in stable condition',
];

export const ENCOUNTER_REASONS = [
  'Routine check-up',
  'Fever and headache',
  'Follow-up visit',
  'Injury assessment',
  'Prenatal care',
  'Chest pain',
  'Abdominal pain',
  'Vaccination',
  'Persistent cough',
  'Skin rash',
  'Diarrhoea and vomiting',
  'Wound dressing',
  'Medication review',
  'Shortness of breath',
  'Joint pain',
  'Eye infection',
  'Ear pain',
  'Dental referral',
  'Post-surgical review',
  'Counselling session',
  'Growth monitoring',
  'Lab result follow-up',
];

export const PRESCRIPTION_NOTES = [
  'Take with food',
  'Avoid alcohol during course',
  'Review in 2 weeks',
  'Monitor for side effects',
  'Reduce dose if drowsy',
  'Continue until course complete',
  'Take on an empty stomach',
  'Do not crush or chew',
  'Store in refrigerator',
  'Apply to affected area only',
  'Shake well before use',
  'Complete full course even if symptoms improve',
  'Take at bedtime',
  'Avoid direct sunlight while using',
];

export const PRESCRIPTION_INDICATIONS = [
  'Bacterial infection',
  'Pain management',
  'Hypertension',
  'Type 2 diabetes',
  'Inflammation',
  'Acid reflux',
  'Malaria treatment',
  'Asthma',
  'Anxiety',
  'Anaemia',
  'Fungal infection',
  'Fever',
  'Allergic reaction',
  'Wound prophylaxis',
  'Tuberculosis',
  'HIV antiretroviral therapy',
];

export const ALLERGY_NOTES = [
  'Reported by patient',
  'Confirmed on previous admission',
  'Family reports childhood reaction',
  'Avoid all related agents',
  'Reaction documented in paper notes',
];

export const CONDITION_NOTES = [
  'Diagnosed at district hospital',
  'Managed in the community',
  'Reviewed annually',
  'Well controlled on current treatment',
  'Under specialist follow-up',
];

export const TASK_NOTES = [
  'Patient asleep, will return',
  'Deferred to next round',
  'Equipment collected from store',
  'Second nurse assisted',
  'Patient off ward for imaging',
  'Completed at bedside',
];

export const QUALITATIVE_LAB_RESULTS = [
  'Positive',
  'Negative',
  'Not detected',
  'Reactive',
  'Non-reactive',
  'Inconclusive',
  'No growth',
];

export const LAB_RESULT_INTERPRETATIONS = [
  'Within normal limits',
  'Slightly elevated, repeat in 2 weeks',
  'Consistent with iron deficiency',
  'Suggests bacterial infection',
  'Below reference range, correlate clinically',
  'Haemolysed sample, recollection advised',
  'No significant abnormality detected',
];

export const IMAGING_RESULT_DESCRIPTIONS = [
  'No acute abnormality detected.',
  'Mild consolidation in the right lower lobe.',
  'No fracture or dislocation seen.',
  'Small pleural effusion on the left.',
  'Cardiomegaly with clear lung fields.',
  'Normal study for age.',
  'Degenerative changes in the lumbar spine.',
  'Single live intrauterine pregnancy.',
];

export const INVOICE_NOTES = [
  'Discussed with patient at reception',
  'Awaiting insurer confirmation',
  'Partial payment received',
  'Approved by finance officer',
  'Item added after discharge',
];

export const INVOICE_DISCOUNT_REASONS = [
  'Financial hardship',
  'Staff discount',
  'Community health card',
  'Insurer agreement',
  'Goodwill adjustment',
];

export const DEATH_CAUSE_NOTES = [
  'Fall from height at home',
  'Road traffic incident',
  'Drowning at the reef',
  'Burns from a cooking fire',
  'Struck by falling debris',
];

export const REGISTRATION_CHANGE_REASONS = [
  'Condition confirmed on review',
  'Resolved after treatment',
  'Recorded in error',
  'Updated after specialist advice',
  'Reclassified following lab results',
];

export const PAUSE_NOTES = [
  'Paused for procedure',
  'Nil by mouth',
  'Awaiting review by prescriber',
  'Patient off ward',
  'Adverse reaction under investigation',
];

export const DISCHARGE_NOTES = [
  'Discharged home with follow-up in 2 weeks',
  'Medications dispensed and explained',
  'Referred to community health worker',
  'Self-discharged against medical advice',
  'Transferred to provincial hospital',
];
