syntax = "proto3";
package pulse.cdm.bind;
option java_package = "com.kitware.pulse.cdm.bind";
option csharp_namespace = "pulse.cdm.bind";
option optimize_for = SPEED;

import "pulse/cdm/bind/Properties.proto";

//

/** @brief An active event, and how long it has been active */
message ActiveEventData
{
  eEvent         Event                       = 1; /**<< @ref eEngineEventTable. */
  ScalarTimeData Duration                    = 2; /**<< @brief The duration since last activated. */
}
message ActiveEventListData
{
  repeated ActiveEventData ActiveEvent       = 1;/**<< @brief Active Events and their duration. */
}

message EventChangeData
{
  eEvent         Event                       = 1; /**<< @ref eEngineEventTable. */
  ScalarTimeData SimTime                     = 2; /**<< @brief The simulation time the event change occured. */
  bool           Active                      = 3; /**<< @brief If the event is active or not. */
}
message EventChangeListData
{
  repeated EventChangeData Change            = 1; /**<< @ref Event changes. */
}

enum eEvent
{
  Antidiuresis                               = 0; /**<< @brief Low urine flow. */
  Bradycardia                                = 1; /**<< @brief The heart rate is slowed to below 60 beats per minute. */
  Bradypnea                                  = 2; /**<< @brief The state at which the respiratory rate has fallen 10 breaths per minute. */
  BrainOxygenDeficit                         = 3; /**<< @brief A lack of oxygen in the brain. Death will occur ~30min*/
  CardiacArrest                              = 4; /**<< @brief Sudden, unexpected loss of heart function, breathing, and consciousness.*/
  CardiogenicShock                           = 5; /**<< @brief Inadequate blood circulation due to failure of the heart ventricles (Cardiac Index < 2.2 L/min m2).*/
  CardiovascularCollapse                     = 6; /**<< @brief Not enough pressure in the veins/arteries to keep inflated.*/
  CriticalBrainOxygenDeficit                 = 7; /**<< @brief A critical lack of oxygen in the brain. Death in under 10min*/
  Diuresis                                   = 8; /**<< @brief High urine flow.*/
  Fasciculation                              = 9; /**<< @brief Brief spontaneous contractions of muscle fibers. */
  Fatigue                                    = 10;/**<< @brief The body is using energy above the Basal Metabolic Rate. */
  FunctionalIncontinence                     = 11;/**<< @brief Uncontrolled bladder release due to a full bladder. */
  Hypercapnia                                = 12;/**<< @brief State at which the arterial carbon dioxide partial pressure has exceeded 60 mmHg. */
  Hyperglycemia                              = 13;/**<< @brief An excess of glucose in the bloodstream (> 200 mg/dL). */
  Hypernatremia                              = 14;/**<< @brief An excess of sodium in the bloodstream (> 295 mOsm/kg). */
  Hyperthermia                               = 15;/**<< @brief The condition of having a body temperature greatly above normal (> 38 C). */
  Hypoglycemia                               = 16;/**<< @brief Low glucose in the bloodstream (< 70 mg/dL). */
  Hyponatremia                               = 17;/**<< @brief Low sodium in the bloodstream (< 135 mEq/L). */
  Hypothermia                                = 18;/**<< @brief The condition of having a body temperature greatly below normal (< 35 C). */
  Hypoxia                                    = 19;/**<< @brief State at which the arterial oxygen partial pressure has fallen below 65 mmHg. */
  HypovolemicShock                           = 20;/**<< @brief The blood volume has dropped below 65% of its normal value. */
  IntracranialHypertension                   = 21;/**<< @brief Intracranial pressure is greater than 25 mmHg. */
  IntracranialHypotension                    = 22;/**<< @brief Intracranial pressure is lower than 7 mmHg. */
  IrreversibleState                          = 23;/**<< @brief An unrecoverable patient state. The engine will cease calculating when this event occurs. */
  Ketoacidosis                               = 24;/**<< @brief A form of metabolic acidosis where the anion gap is driven by the rise in ketones. */
  LacticAcidosis                             = 25;/**<< @brief A form of metabolic acidosis where the blood lactate concentration rises. */
  MassiveHemothorax                          = 26;/**<< @brief Intrapleural blood drainage (> 1000mL). */
  MaximumPulmonaryVentilationRate            = 27;/**<< @brief The maximum pulmonary ventilation rate has been reached. */
  MediumHemothorax                           = 28;/**<< @brief Intrapleural blood drainage (> 400mL, < 1000 mL). */
  MetabolicAcidosis                          = 29;/**<< @brief A condition where the body is producing excess acids. (pH < 7.35). */
  MetabolicAlkalosis                         = 30;/**<< @brief A condition where the body is producing excess bases. (pH > 7.45). */
  MildDehydration                            = 31;/**<< @brief A loss of more fluid than is taken in (More than 3% loss of healthy/initial fluid mass). */
  MinimalHemothorax                          = 32;/**<< @brief Intrapleural blood drainage (< 400mL). */
  ModerateDehydration                        = 33;/**<< @brief A loss of more fluid than is taken in (More than 5% loss of healthy/initial fluid mass). */
  ModerateHyperoxemia                        = 34;/**<< @brief State at which the arterial oxygen partial pressure has risen above 120 mmHg. */
  ModerateHypocapnia                         = 35;/**<< @brief State at which the arterial carbon dioxide partial pressure has fallen below 30 mmHg. */
  MyocardiumOxygenDeficit                    = 36;/**<< @brief The myocardium oxygen level has decreased below 5 mmHg. */
  Natriuresis                                = 37;/**<< @brief Sodium excretion above normal levels. */
  NutritionDepleted                          = 38;/**<< @brief The stomach is empty. */
  RenalHypoperfusion                         = 39;/**<< @brief Low blood flow to the kidneys. */
  RespiratoryAcidosis                        = 40;/**<< @brief An increase of CO2 concentration in the bloodstream and a decrease in blood pH. */
  RespiratoryAlkalosis                       = 41;/**<< @brief An decrease of CO2 concentration in the bloodstream and a increase in blood pH. */
  SevereDehydration                          = 42;/**<< @brief A loss of more fluid than is taken in (More than 10% loss of healthy/initial fluid mass). */
  SevereHyperoxemia                          = 43;/**<< @brief State at which the arterial oxygen partial pressure has risen above 200 mmHg. */
  SevereHypocapnia                           = 44;/**<< @brief State at which the arterial carbon dioxide partial pressure has fallen below 15 mmHg. */
  Stabilizing                                = 45;/**<< @brief The engine is stabilizing to a new homeostasis state, its not recommended to add any actions when active. */
  StartOfCardiacCycle                        = 46;/**<< @brief The Patient is starting a new heart beat. */
  StartOfExhale                              = 47;/**<< @brief Patient is starting to exhale. */
  StartOfInhale                              = 48;/**<< @brief Patient is starting to inhale. */
  Tachycardia                                = 49;/**<< @brief The heart rate is elevated above 100 beats per minute. */
  Tachypnea                                  = 50;/**<< @brief A breathing rate above 20 breaths per minute. */
  // Equipment
  AnesthesiaMachineOxygenBottleOneExhausted  = 1000;/**<< @brief Anesthesia machine oxygen bottle one has been exhausted. */
  AnesthesiaMachineOxygenBottleTwoExhausted  = 1001;/**<< @brief Anesthesia machine oxygen bottle two has been exhausted. */
  AnesthesiaMachineReliefValveActive         = 1002;/**<< @brief Anesthesia machine relief valve is active. */
  MechanicalVentilatorReliefValveActive      = 1003;/**<< @brief Mechanical ventilator relief valve is active. */
  SupplementalOxygenBottleExhausted          = 1004;/**<< @brief The supplemental oxygen bottle is exhausted. There is no longer any oxygen to provide. */
  NonRebreatherMaskOxygenBagEmpty            = 1005;/**<< @brief The non rebreather mask oxygen bag is empty. Oxygen may need to be provided at a faster rate. */
}
