syntax = "proto3";
package cdm;
option java_package = "com.kitware.physiology.cdm";

import "cdm/Properties.proto";
import "cdm/ElectroCardioGram.proto";

/** @brief Static timed stabilization lengths */
message PhysiologyEngineTimedStabilizationData
{
  message ConditionTimingData
  {
    string                                    Name                           = 1;/**<< @brief */
    ScalarTimeData                            StabilizationTime              = 2;/**<< @brief */
  }
  
  eSwitch                                     TrackingStabilization          = 1;/**<< @brief Track data requests to the output file (if provided) during stabilization. */
  ScalarTimeData                              RestingStabilizationTime       = 2;/**<< @brief */
  ScalarTimeData                              FeedbackStabilizationTime      = 3;/**<< @brief */
  repeated ConditionTimingData                ConditionStabilization         = 4;/**<< @brief */
}


/** @brief Dynamic stabilization parameters */
message PhysiologyEngineDynamicStabilizationData
{

  /** @brief A properties target percent difference allowed */
  message PropertyConvergenceData
  {
    string                                    Name                            = 1;/**<< @brief */
    double                                    PercentDifference               = 2;/**<< @brief */
  }
  
  /** @brief A properties convergence timing */
  message CriteriaData
  {
    ScalarTimeData                            ConvergenceTime                 = 1;/**<< @brief */
    ScalarTimeData                            MinimumReactionTime             = 2;/**<< @brief */
    ScalarTimeData                            MaximumAllowedStabilizationTime = 3;/**<< @brief */
    repeated PropertyConvergenceData          PropertyConvergence             = 4;/**<< @brief */
  }
  
  message ConditionCriteriaData
  {
    string                                    Name                            = 1;/**<< @brief */
    CriteriaData                              Criteria                        = 2;/**<< @brief */
  }

  eSwitch                                     TrackingStabilization           = 1;/**<< @brief Track data requests to the output file (if provided) during stabilization. */
  CriteriaData                                RestingStabilizationCriteria    = 2;/**<< @brief */
  CriteriaData                                FeedbackStabilizationCriteria   = 3;/**<< @brief */
  repeated ConditionCriteriaData              ConditionStabilizationCriteria  = 4;/**<< @brief */
}

/** @brief Engine configuration parameters */
message PhysiologyEngineConfigurationData
{
  ScalarTimeData                              TimeStep                        = 1;/**<< @brief */
  eSwitch                                     WritePatientBaselineFile        = 2;/**<< @brief */

  oneof ElectroCardioGramInterpolator
  {
    string                                    InterpolatorFileName            = 3;/**<< @brief */
    ElectroCardioGramWaveformInterpolatorData Interpolator                    = 4;/**<< @brief */
  }

  oneof StabilizationCriteria
  {
    string                                    StabilizationFileName           = 5;/**<< @brief */
    PhysiologyEngineTimedStabilizationData    TimedStabilization              = 6;/**<< @brief */
    PhysiologyEngineDynamicStabilizationData  DynamicStabilization            = 7;/**<< @brief */
  }
}