/*
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 *
 * Code generated by Microsoft (R) AutoRest Code Generator.
 * Changes may cause incorrect behavior and will be lost if the code is
 * regenerated.
 */

'use strict';

const models = require('./index');

/**
 * Contains detailed Chaos report.
 *
 *
 */
class ChaosReport {
  /**
   * Create a ChaosReport.
   * @member {object} [chaosParameters]
   * @member {string} [chaosParameters.timeToRunInSeconds] Total time (in
   * seconds) for which Chaos will run before automatically stopping. The
   * maximum allowed value is 4,294,967,295 (System.UInt32.MaxValue).
   * @member {number} [chaosParameters.maxClusterStabilizationTimeoutInSeconds]
   * The maximum amount of time to wait for all cluster entities to become
   * stable and healthy. Chaos executes in iterations and at the start of each
   * iteration it validates the health of cluster entities.
   * During validation if a cluster entity is not stable and healthy within
   * MaxClusterStabilizationTimeoutInSeconds, Chaos generates a validation
   * failed event.
   * @member {number} [chaosParameters.maxConcurrentFaults] MaxConcurrentFaults
   * is the maximum number of concurrent faults induced per iteration.
   * Chaos executes in iterations and two consecutive iterations are separated
   * by a validation phase.
   * The higher the concurrency, the more aggressive the injection of faults --
   * inducing more complex series of states to uncover bugs.
   * The recommendation is to start with a value of 2 or 3 and to exercise
   * caution while moving up.
   * @member {boolean} [chaosParameters.enableMoveReplicaFaults] Enables or
   * disables the move primary and move secondary faults.
   * @member {number} [chaosParameters.waitTimeBetweenFaultsInSeconds] Wait
   * time (in seconds) between consecutive faults within a single iteration.
   * The larger the value, the lower the overlapping between faults and the
   * simpler the sequence of state transitions that the cluster goes through.
   * The recommendation is to start with a value between 1 and 5 and exercise
   * caution while moving up.
   * @member {number} [chaosParameters.waitTimeBetweenIterationsInSeconds]
   * Time-separation (in seconds) between two consecutive iterations of Chaos.
   * The larger the value, the lower the fault injection rate.
   * @member {object} [chaosParameters.clusterHealthPolicy]
   * @member {boolean}
   * [chaosParameters.clusterHealthPolicy.considerWarningAsError] Indicates
   * whether warnings are treated with the same severity as errors.
   * @member {number}
   * [chaosParameters.clusterHealthPolicy.maxPercentUnhealthyNodes] The maximum
   * allowed percentage of unhealthy nodes before reporting an error. For
   * example, to allow 10% of nodes to be unhealthy, this value would be 10.
   *
   * The percentage represents the maximum tolerated percentage of nodes that
   * can be unhealthy before the cluster is considered in error.
   * If the percentage is respected but there is at least one unhealthy node,
   * the health is evaluated as Warning.
   * The percentage is calculated by dividing the number of unhealthy nodes
   * over the total number of nodes in the cluster.
   * The computation rounds up to tolerate one failure on small numbers of
   * nodes. Default percentage is zero.
   *
   * In large clusters, some nodes will always be down or out for repairs, so
   * this percentage should be configured to tolerate that.
   * @member {number}
   * [chaosParameters.clusterHealthPolicy.maxPercentUnhealthyApplications] The
   * maximum allowed percentage of unhealthy applications before reporting an
   * error. For example, to allow 10% of applications to be unhealthy, this
   * value would be 10.
   *
   * The percentage represents the maximum tolerated percentage of applications
   * that can be unhealthy before the cluster is considered in error.
   * If the percentage is respected but there is at least one unhealthy
   * application, the health is evaluated as Warning.
   * This is calculated by dividing the number of unhealthy applications over
   * the total number of application instances in the cluster, excluding
   * applications of application types that are included in the
   * ApplicationTypeHealthPolicyMap.
   * The computation rounds up to tolerate one failure on small numbers of
   * applications. Default percentage is zero.
   * @member {array}
   * [chaosParameters.clusterHealthPolicy.applicationTypeHealthPolicyMap]
   * @member {object} [chaosParameters.context]
   * @member {object} [chaosParameters.context.map]
   * @member {string} [status] Current status of the Chaos run.
   *
   * - Invalid - Indicates an invalid Chaos status. All Service Fabric
   * enumerations have the invalid type.
   * The valus is zero.
   * - Running - Indicates that Chaos is not stopped.
   * - Stopped - Indicates that Chaos is not scheduling futher faults. Possible
   * values include: 'Invalid', 'Running', 'Stopped'
   * @member {string} [continuationToken]
   * @member {array} [history]
   */
  constructor() {
  }

  /**
   * Defines the metadata of ChaosReport
   *
   * @returns {object} metadata of ChaosReport
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ChaosReport',
      type: {
        name: 'Composite',
        className: 'ChaosReport',
        modelProperties: {
          chaosParameters: {
            required: false,
            serializedName: 'ChaosParameters',
            type: {
              name: 'Composite',
              className: 'ChaosParameters'
            }
          },
          status: {
            required: false,
            serializedName: 'Status',
            type: {
              name: 'String'
            }
          },
          continuationToken: {
            required: false,
            serializedName: 'ContinuationToken',
            type: {
              name: 'String'
            }
          },
          history: {
            required: false,
            serializedName: 'History',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'ChaosEventWrapperElementType',
                  type: {
                    name: 'Composite',
                    className: 'ChaosEventWrapper'
                  }
              }
            }
          }
        }
      }
    };
  }
}

module.exports = ChaosReport;
