{
  "app_name": "Healthcare Management System",
  "pages": [
    {
      "page_id": "dashboard",
      "page_title": "Dashboard",
      "route_path": "/",
      "route_params": [],
      "image_indices": [],
      "description": "Central hub displaying key metrics and quick access to common functions. Contains stat cards showing: total patients count, today's appointments count, today's consultations count, and today's revenue. Includes a 'Pending Check-ins' list showing patients with scheduled appointments awaiting check-in. Displays a 'Today's Appointments' summary table with columns: Patient Name, Doctor, Department, Time, Status (color-coded badges: Scheduled=blue, Checked-in=green, In Progress=orange, Completed=gray, Cancelled=red). Shows a department-wise appointment distribution pie/bar chart. Has quick action buttons: 'Register Patient', 'New Appointment', 'New Consultation'. Includes a recent patient registrations list (last 5). Notification bell icon with unread count in the header. Global search bar to search patients/appointments by ID, name, or phone. Sidebar navigation with links to: Dashboard, Patient Management, Appointments, Clinical, Billing & Reports. User profile dropdown with logout option in top-right corner. System announcements/alerts section showing pending lab results and upcoming appointment reminders.",
      "navigates_to": [
        "patient_management",
        "appointments",
        "clinical",
        "billing_reports"
      ]
    },
    {
      "page_id": "patient_management",
      "page_title": "Patient Management",
      "route_path": "/patients",
      "route_params": [],
      "image_indices": [],
      "description": "Comprehensive patient registration, search, and profile management page. Primary view is a paginated patient list table with columns: Patient ID, Name, Age, Gender, Contact (phone), Email, Insurance Provider, Last Visit Date, Status (Active/Inactive badge). Above the table: search bar (search by name, patient ID, phone, email), filter dropdowns for registration date range, insurance provider, and status. Sort options for name, registration date, last visit. Action buttons per row: View Profile, Edit (opens modal), View History. Export button to download patient list as Excel/CSV. 'Register New Patient' button opens a modal/drawer with form fields: First Name, Last Name, Middle Name, Date of Birth (with auto-calculated age display), Gender (Male/Female/Other radio), Mobile Number (required), Email, Alternate Phone, Address (Street, City, State, Postal Code, Country), Emergency Contact Name, Emergency Contact Relationship, Emergency Contact Phone (required), Insurance Provider (dropdown from insurance providers list), Policy Number, Blood Group (dropdown: A+, A-, B+, B-, AB+, AB-, O+, O-), Known Allergies (textarea), Patient Photo upload, Status toggle (Active/Inactive). System auto-generates unique Patient ID on save. 'View Profile' action opens a detailed patient profile drawer/modal showing: complete demographics, medical record summary (blood group, allergies, chronic conditions), appointment history table (date, doctor, department, status), consultation history with diagnoses, prescriptions list, vital signs trend mini-chart, lab test results history, billing history with outstanding balance. Edit patient button (permission-gated). 'Schedule Appointment' button from profile. Print patient summary button.",
      "navigates_to": [
        "dashboard",
        "appointments",
        "clinical",
        "billing_reports"
      ]
    },
    {
      "page_id": "appointments",
      "page_title": "Appointments & Scheduling",
      "route_path": "/appointments",
      "route_params": [],
      "image_indices": [],
      "description": "Complete appointment lifecycle management page with calendar and list views. Tabs or toggle to switch between Calendar View and List View. Calendar View: supports Month, Week, and Day views with navigation arrows and today button. Appointments displayed as color-coded blocks (Scheduled=blue, Checked-in=green, In Progress=orange, Completed=gray, Cancelled=red). Filter controls: Department dropdown, Doctor dropdown (filtered by department), Appointment Type dropdown, Date range picker. Clicking an appointment block opens a details popover showing patient name, doctor, time, status, reason for visit, with action buttons (Check-in, Cancel, Reschedule, Complete). List View: table with columns: Appointment ID, Patient Name, Doctor, Department, Date, Time, Duration, Type (New/Follow-up/Emergency/Check-up), Status, Priority (Normal/Urgent badge). Quick filters: Today, This Week, Upcoming (next 7 days). Search by patient name or ID. Filter by status, date range, doctor, department. Export to Excel button. 'New Appointment' button opens a modal/drawer with form: Patient (searchable dropdown with option to quick-register new patient), Department (dropdown), Doctor (filtered by department), Date (calendar picker showing only future dates), Time Slot (shows only available slots for selected doctor/date), Duration (default based on type, editable), Appointment Type (New Consultation, Follow-up, Emergency, Check-up), Reason for Visit/Chief Complaint (textarea), Internal Notes (textarea, staff-only), Priority (Normal/Urgent radio), Send Confirmation checkbox. Validates no double-booking. Row actions: Check-in (updates status), Cancel (opens reason modal), Reschedule (opens date/time picker modal), Print Confirmation Slip. Doctor's queue view showing ordered list of checked-in patients with estimated wait times.",
      "navigates_to": [
        "dashboard",
        "patient_management",
        "clinical",
        "billing_reports"
      ]
    },
    {
      "page_id": "clinical",
      "page_title": "Clinical & Consultation",
      "route_path": "/clinical",
      "route_params": [],
      "image_indices": [],
      "description": "Medical consultation documentation, prescriptions, vital signs, and lab test management. Main view shows a list/table of consultations with columns: Consultation ID, Patient Name, Doctor, Date, Chief Complaint, Diagnosis (primary), Status (Draft/Completed badge). Filters: date range, doctor dropdown, patient search, status filter. 'Start Consultation' button (enabled only for checked-in appointments) opens a consultation form/workspace with sections: Patient Summary panel (name, age, gender, allergies, chronic conditions, current vitals), Previous Consultations accordion/collapsible list. Consultation Form fields: Chief Complaint (required textarea), History of Present Illness (textarea), Physical Examination Findings (textarea), Diagnosis section (searchable input with ICD-10 support, ability to add multiple diagnoses marking primary/secondary), Treatment Plan (textarea), Clinical Notes (textarea), Status (Save as Draft / Mark Complete). Vital Signs Recording section (inline form or modal): Blood Pressure (systolic/diastolic inputs), Temperature (with C/F toggle), Pulse Rate (bpm), Respiratory Rate, Oxygen Saturation (SpO2 %), Weight (kg/lbs toggle), Height (cm/inches toggle), auto-calculated BMI display, timestamp, recorded-by staff field. Vital signs history graph/chart for the patient. Prescription Management section within consultation: 'Add Prescription' button opens inline form or modal with fields: Medication Name (searchable from drug database or free text), Dosage Strength (e.g. 500mg), Dosage Form (tablet/capsule/syrup/injection dropdown), Frequency (once/twice/thrice daily, every 6 hours, etc.), Duration (number of days), Timing (before food/after food/empty stomach), Special Instructions (text). Table of added medications with remove button. Drug-allergy interaction warning display. Save and Print Prescription buttons. Lab Test Orders section: 'Order Lab Test' button opens form with searchable test catalog, ability to add multiple tests, urgent/priority toggle, special instructions textarea. Lab tests table showing: Test Name, Ordered Date, Status (Ordered/Sample Collected/Processing/Completed), Results (view link when available). Actions: Collect Sample, Enter Results (opens modal with result values, reference ranges, abnormal flag, document upload), Print Requisition. Consultation History tab: list of all past consultations for selected patient with date, doctor, diagnosis summary cards, expandable to view full notes, prescriptions, and lab tests from that visit. Export consultation history to PDF button.",
      "navigates_to": [
        "dashboard",
        "patient_management",
        "appointments",
        "billing_reports"
      ]
    },
    {
      "page_id": "billing_reports",
      "page_title": "Billing & Reports",
      "route_path": "/billing",
      "route_params": [],
      "image_indices": [],
      "description": "Financial management, invoicing, payment processing, service catalog, and analytics reports. Page has tabs or sub-navigation: Invoices, Payments, Services, Insurance, Reports. INVOICES TAB: Table with columns: Invoice #, Date, Patient Name, Services Summary, Subtotal, Discount, Tax, Total Amount, Status (Unpaid/Partially Paid/Paid/Refunded color-coded badge), Actions. Search by patient name/ID or invoice number. Filters: status, date range, payment method. Quick views: Outstanding Only, Paid Only. Export to Excel. 'Create Invoice' button opens modal/drawer: Patient (searchable dropdown, auto-populates info), linked Consultation (dropdown of completed consultations for patient). Line Items section: Add from Service Catalog (searchable dropdown) or custom line item (description + price). Each line: Service Name, Description, Quantity (number input), Unit Price, Line Total (auto-calculated). Add/Remove line item buttons. Subtotal (auto-sum), Discount (% or fixed amount input), Tax (configurable %), Grand Total (prominently displayed). Invoice Notes textarea. Save/Issue button generates unique sequential invoice number. View Invoice Detail popover/modal showing full breakdown and payment history. Print Invoice button. PAYMENTS TAB: Table with columns: Payment ID, Invoice #, Patient, Amount, Method, Reference #, Date, Processed By. 'Record Payment' button opens modal: Select Invoice (dropdown of unpaid/partially paid), Payment Amount, Payment Method (Cash/Credit Card/Debit Card/Bank Transfer/Insurance/UPI/Other dropdown), Reference Number, Date, Notes. Validates amount doesn't exceed balance. Shows remaining balance after payment. Partial payment support with balance tracking. Print Receipt button. Process Refund action (opens modal with reason field, validates against total paid). SERVICES TAB: Master service catalog table: Service Name, Category, Department, Duration, Price, Status (Active/Inactive). 'Add Service' button opens modal: Name, Description, Category, Department (dropdown), Duration (minutes), Price, Status toggle. Edit/Deactivate actions per row. Search and filter by category/department. INSURANCE TAB: Insurance provider directory table: Provider Name, Contact, Phone, Email, Policies Count. 'Add Provider' modal: Name, Contact Person, Phone, Email, Address, Coverage Policy Notes. Edit/Delete actions. Patient insurance linking managed from Patient Management. Claim tracking table: Claim ID, Patient, Invoice, Provider, Amount, Status (Submitted/Approved/Denied/Paid), Date. Update claim status action. REPORTS TAB: Report type selector (cards or dropdown): Patient Statistics, Appointment Report, Revenue Report, Daily Collection, Outstanding Balance (Aging), Department Utilization, Service-wise Revenue, Payment Method Breakdown, Patient Visit Frequency. Date range picker and filter controls (department, doctor, service type). 'Generate Report' button. Report display area with data tables and chart visualizations (bar, line, pie charts). Key metric summary cards at top (Total Revenue, Total Appointments, Pending Payments, New Patients). Export to PDF and Excel buttons. Report data refreshes in real-time.",
      "navigates_to": [
        "dashboard",
        "patient_management",
        "appointments",
        "clinical"
      ]
    }
  ],
  "shared_state": [
    {
      "key": "currentUser",
      "type": "{ id: string; name: string; role: 'administrator' | 'doctor' | 'nurse' | 'receptionist' | 'billing_officer'; department?: string } | null",
      "initial_value": "null",
      "description": "Currently authenticated user with role information, used for RBAC across all pages to control feature visibility and access"
    },
    {
      "key": "selectedPatientId",
      "type": "string | null",
      "initial_value": "null",
      "description": "Currently selected patient ID, shared across patient management, appointments, clinical, and billing pages for contextual workflows"
    },
    {
      "key": "notifications",
      "type": "{ id: string; message: string; type: string; read: boolean; timestamp: string }[]",
      "initial_value": "[]",
      "description": "System notifications displayed in header bell icon across all pages, including pending lab results, appointment reminders, and system alerts"
    }
  ],
  "default_route": "dashboard",
  "design_system": {
    "theme_mode": "light",
    "density": "comfortable",
    "color_primary": "#1677ff",
    "color_success": "#52c41a",
    "color_warning": "#faad14",
    "color_error": "#ff4d4f",
    "color_bg_container": "#ffffff",
    "color_bg_layout": "#f5f5f5",
    "color_text": "#000000e0",
    "color_border": "#d9d9d9",
    "font_family": "Inter, -apple-system, sans-serif",
    "font_size_base": 14,
    "border_radius": 6,
    "component_overrides": {}
  }
}
