{
  "ConnectionStrings": {
    "DefaultConnection": "Host=localhost;Port=5436;Database=vigilcare;Username=postgres;Password=password"
  },
  "Redis": {
    "ConnectionString": "localhost:6382"
  },
  "Seq": {
    "ServerUrl": "http://localhost:5345"
  },
  "Serilog": {
    "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.Seq" ],
    "MinimumLevel": {
      "Default": "Information",
      "Override": {
        "Microsoft.AspNetCore": "Warning",
        "Microsoft.EntityFrameworkCore.Database.Command": "Information"
      }
    },
    "WriteTo": [
      { "Name": "Console" },
      {
        "Name": "Seq",
        "Args": {
          "serverUrl": "http://localhost:5345"
        }
      }
    ],
    "Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ]
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning",
      "Microsoft.EntityFrameworkCore.Database.Command": "Information"
    }
  },
  "AllowedHosts": "*",
  "Dashboard": {
    "CorsOrigins": [ "http://localhost:5173" ]
  },
  "Kafka": {
    "BootstrapServers": "localhost:9092",
    "Topics": {
      "ObservationRecorded": "observation.recorded",
      "AlertGenerated": "alert.generated",
      "EncounterStatusChanged": "encounter.status.changed",
      "GcsScored": "gcs.scored"
    },
    "NumPartitions": 6,
    "OutboxBatchSize": 100,
    "OutboxPollIntervalMs": 1000
  },
  "Elasticsearch": {
    "Uri": "http://localhost:9200",
    "Indices": {
      "PatientEncounters": "patient_encounters",
      "Observations": "observations",
      "ClinicalAlerts": "clinical_alerts"
    }
  },
  "RabbitMq": {
    "Host": "localhost",
    "Port": 5674,
    "Username": "guest",
    "Password": "guest",
    "PagingAckTimeoutMs": 300000
  },
  "Minio": {
    "Endpoint": "localhost:9005",
    "AccessKey": "minioadmin",
    "SecretKey": "minioadmin",
    "BucketName": "vigilcare",
    "UseSSL": false
  },
  "ReconciliationJobs": {
    "IntervalMinutes": 30,
    "UnacknowledgedAlertThresholdMinutes": 30,
    "PendingOrderThresholdHours": 4,
    "NoObservationThresholdHours": 2
  },
  "DataLake": {
    "FlushCount": 1000,
    "FlushIntervalSeconds": 300
  },
  "TrendDetection": {
    "WindowMinutes": 30,
    "MaxHistoryEntries": 10,
    "HistoryTtlSeconds": 7200,
    "RateThresholdsPerMinute": {
      "HEART_RATE": 0.5,
      "RESP_RATE": 0.3,
      "SYSTOLIC_BP": 1.0,
      "TEMP_C": 0.05,
      "SPO2": 0.2
    }
  },
  "AlertSuppression": {
    "DefaultWindowMinutes": 30
  },
  "MedicationCorrelation": {
    "CorrelationWindowMinutes": 90,
    "DrugVitalMappings": {
      "metoprolol": ["SYSTOLIC_BP", "HEART_RATE", "DIASTOLIC_BP"],
      "labetalol": ["SYSTOLIC_BP", "HEART_RATE", "DIASTOLIC_BP"],
      "atenolol": ["SYSTOLIC_BP", "HEART_RATE", "DIASTOLIC_BP"],
      "propranolol": ["SYSTOLIC_BP", "HEART_RATE", "DIASTOLIC_BP"],
      "esmolol": ["SYSTOLIC_BP", "HEART_RATE", "DIASTOLIC_BP"],
      "carvedilol": ["SYSTOLIC_BP", "HEART_RATE", "DIASTOLIC_BP"],

      "norepinephrine": ["SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE"],
      "epinephrine": ["SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE", "GLUCOSE_MG_DL"],
      "vasopressin": ["SYSTOLIC_BP", "DIASTOLIC_BP"],
      "dopamine": ["SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE"],
      "dobutamine": ["SYSTOLIC_BP", "HEART_RATE"],
      "phenylephrine": ["SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE"],

      "diltiazem": ["HEART_RATE", "SYSTOLIC_BP", "DIASTOLIC_BP"],
      "verapamil": ["HEART_RATE", "SYSTOLIC_BP", "DIASTOLIC_BP"],
      "amlodipine": ["SYSTOLIC_BP", "DIASTOLIC_BP"],
      "nicardipine": ["SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE"],

      "nitroglycerin": ["SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE"],
      "nitroprusside": ["SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE"],
      "hydralazine": ["SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE"],

      "morphine": ["RESP_RATE", "SPO2", "SYSTOLIC_BP", "HEART_RATE"],
      "fentanyl": ["RESP_RATE", "SPO2", "HEART_RATE"],
      "hydromorphone": ["RESP_RATE", "SPO2", "SYSTOLIC_BP"],
      "remifentanil": ["RESP_RATE", "SPO2", "HEART_RATE"],

      "propofol": ["RESP_RATE", "SPO2", "SYSTOLIC_BP", "HEART_RATE"],
      "midazolam": ["RESP_RATE", "SPO2"],
      "lorazepam": ["RESP_RATE", "SPO2"],
      "ketamine": ["HEART_RATE", "SYSTOLIC_BP", "RESP_RATE"],

      "amiodarone": ["HEART_RATE", "SYSTOLIC_BP"],
      "adenosine": ["HEART_RATE"],
      "digoxin": ["HEART_RATE"],
      "atropine": ["HEART_RATE"],

      "heparin": ["HEART_RATE"],

      "acetaminophen": ["TEMP_C"],
      "ibuprofen": ["TEMP_C"],

      "insulin": ["GLUCOSE_MG_DL"],
      "dextrose": ["GLUCOSE_MG_DL"],
      "glucagon": ["GLUCOSE_MG_DL"],

      "dexamethasone": ["GLUCOSE_MG_DL", "TEMP_C"],
      "methylprednisolone": ["GLUCOSE_MG_DL", "TEMP_C"],
      "hydrocortisone": ["GLUCOSE_MG_DL", "TEMP_C"],
      "prednisone": ["GLUCOSE_MG_DL", "TEMP_C"],

      "furosemide": ["SYSTOLIC_BP", "DIASTOLIC_BP"],

      "albuterol": ["HEART_RATE", "SPO2"]
    }
  },
  "Sofa": {
    "LabStalenessHours": 24,
    "LabWarningHours": 12,
    "UseSpO2FiO2Fallback": true,
    "VasopressorWindowHours": 1
  },
  "Fhir": {
    "ApiKey": "dev-integration-key-change-in-production",
    "PatientIdentifierSystems": [
      "urn:oid:2.16.840.1.113883.4.1",
      "http://hospital.example/mrn"
    ],
    "EncounterIdentifierSystems": [
      "http://hospital.example/visit"
    ],
    "InternalPatientIdSystem": "http://vigilcare.local/patient-id",
    "InternalEncounterIdSystem": "http://vigilcare.local/encounter-id",
    "DefaultDepartment": "GENERAL_MEDICINE",
    "DefaultEncounterType": "INPATIENT",
    "DepartmentCodeMap": {
      "ICU": "ICU",
      "EMER": "EMERGENCY",
      "CARD": "CARDIOLOGY",
      "SURG": "SURGERY",
      "PEDI": "PEDIATRICS",
      "MED": "GENERAL_MEDICINE"
    },
    "EncounterClassMap": {
      "IMP": "INPATIENT",
      "AMB": "OUTPATIENT",
      "EMER": "EMERGENCY"
    }
  },
  "Jwt": {
    "Issuer": "VigilCareClinical",
    "Audience": "VigilCareClinical.Dashboard",
    "SigningKey": "DEV-ONLY-REPLACE-WITH-256-BIT-SECRET-IN-PRODUCTION-abc123xyz",
    "ExpirationMinutes": 480
  },
  "PhiEncryption": {
    "ProtectorPurpose": "VigilCare.PatientPhi.v1",
    "SearchTokenKey": "DEV-ONLY-HMAC-KEY-REPLACE-IN-PRODUCTION-32bytes!!",
    "LogListAccess": true
  },
  "DataProtection": {
    "KeyPath": "./data-protection-keys"
  },
  "ApiKey": {
    "Gateway": "dev-gateway-key-change-in-production"
  },
  "ClinicalSync": {
    "SuppressPagingForSyncedAlerts": true
  }
}
