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. */
  Asystole                                   = 1; /**<< @brief Represents no cardiac electrical activity. */
  Bradycardia                                = 2; /**<< @brief The heart rate is slowed to below 60 beats per minute. */
  Bradypnea                                  = 3; /**<< @brief The state at which the respiratory rate has fallen 10 breaths per minute. */     
  BrainOxygenDeficit                         = 4; /**<< @brief A lack of oxygen in the brain. Death will occur ~30min*/
  CardiacArrest                              = 5; /**<< @brief Sudden, unexpected loss of heart function, breathing, and consciousness.*/
  CardiogenicShock                           = 6; /**<< @brief Inadequate blood circulation due to failure of the heart ventricles (Cardiac Index < 2.2 L/min m2).*/
  CardiovascularCollapse                     = 7; /**<< @brief Not enough pressure in the veins/arteries to keep inflated.*/
  CriticalBrainOxygenDeficit                 = 8; /**<< @brief A critical lack of oxygen in the brain. Death in under 10min*/
  Dehydration                                = 9; /**<< @brief A loss of more fluid than is taken in (More than 3% loss of resting fluid mass). */
  Diuresis                                   = 10;/**<< @brief High urine flow.*/
  Fasciculation                              = 11;/**<< @brief Brief spontaneous contractions of muscle fibers. */
  Fatigue                                    = 12;/**<< @brief The body is using energy above the Basal Metabolic Rate. */
  FunctionalIncontinence                     = 13;/**<< @brief Uncontrolled bladder release due to a full bladder. */
  Hypercapnia                                = 14;/**<< @brief State at which the arterial carbon dioxide partial pressure has exceeded 60 mmHg. */
  Hyperglycemia                              = 15;/**<< @brief An excess of glucose in the bloodstream (> 200 mg/dL). */
  Hyperthermia                               = 16;/**<< @brief The condition of having a body temperature greatly above normal (> 38 C). */
  Hypoglycemia                               = 17;/**<< @brief Low glucose in the bloodstream (< 70 mg/dL). */
  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. */
  MaximumPulmonaryVentilationRate            = 26;/**<< @brief The maximum pulmonary ventilation rate has been reached. */
  MetabolicAcidosis                          = 27;/**<< @brief A condition where the body is producing excess acids. (pH < 7.35). */
  MetabolicAlkalosis                         = 28;/**<< @brief A condition where the body is producing excess bases. (pH > 7.45). */
  ModerateHyperoxemia                        = 29;/**<< @brief State at which the arterial oxygen partial pressure has risen above 120 mmHg. */
  ModerateHypocapnia                         = 30;/**<< @brief State at which the arterial carbon dioxide partial pressure has fallen below 30 mmHg. */  
  MyocardiumOxygenDeficit                    = 31;/**<< @brief The myocardium oxygen level has decreased below 5 mmHg. */
  Natriuresis                                = 32;/**<< @brief Sodium excretion above normal levels. */
  NutritionDepleted                          = 33;/**<< @brief The stomach is empty. */
  RenalHypoperfusion                         = 34;/**<< @brief Low blood flow to the kidneys. */
  RespiratoryAcidosis                        = 35;/**<< @brief An increase of CO2 concentration in the bloodstream and a decrease in blood pH. */
  RespiratoryAlkalosis                       = 36;/**<< @brief An decrease of CO2 concentration in the bloodstream and a increase in blood pH. */
  SevereHyperoxemia                          = 37;/**<< @brief State at which the arterial oxygen partial pressure has risen above 200 mmHg. */
  SevereHypocapnia                           = 38;/**<< @brief State at which the arterial carbon dioxide partial pressure has fallen below 15 mmHg. */  
  StartOfCardiacCycle                        = 39;/**<< @brief The Patient is starting a new heart beat. */
  StartOfExhale                              = 40;/**<< @brief Patient is starting to exhale. */
  StartOfInhale                              = 41;/**<< @brief Patient is starting to inhale. */
  Tachycardia                                = 42;/**<< @brief The heart rate is elevated above 100 beats per minute. */
  Tachypnea                                  = 43;/**<< @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. */
  SupplementalOxygenBottleExhausted          = 1003;/**<< @brief The supplemental oxygen bottle is exhausted. There is no longer any oxygen to provide. */
  NonRebreatherMaskOxygenBagEmpty            = 1004;/**<< @brief The non rebreather mask oxygen bag is empty. Oxygen may need to be provided at a faster rate. */
}