/*
 * 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';

/**
 * A rule that provide the triggers and parameters for the scaling action.
 *
 */
class ScaleRule {
  /**
   * Create a ScaleRule.
   * @property {object} metricTrigger the trigger that results in a scaling
   * action.
   * @property {string} [metricTrigger.metricName] the name of the metric that
   * defines what the rule monitors.
   * @property {string} [metricTrigger.metricResourceUri] the resource
   * identifier of the resource the rule monitors.
   * @property {moment.duration} [metricTrigger.timeGrain] the granularity of
   * metrics the rule monitors. Must be one of the predefined values returned
   * from metric definitions for the metric. Must be between 12 hours and 1
   * minute.
   * @property {string} [metricTrigger.statistic] the metric statistic type.
   * How the metrics from multiple instances are combined. Possible values
   * include: 'Average', 'Min', 'Max', 'Sum'
   * @property {moment.duration} [metricTrigger.timeWindow] the range of time
   * in which instance data is collected. This value must be greater than the
   * delay in metric collection, which can vary from resource-to-resource. Must
   * be between 12 hours and 5 minutes.
   * @property {string} [metricTrigger.timeAggregation] time aggregation type.
   * How the data that is collected should be combined over time. The default
   * value is Average. Possible values include: 'Average', 'Minimum',
   * 'Maximum', 'Total', 'Count', 'Last'
   * @property {string} [metricTrigger.operator] the operator that is used to
   * compare the metric data and the threshold. Possible values include:
   * 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan',
   * 'LessThanOrEqual'
   * @property {number} [metricTrigger.threshold] the threshold of the metric
   * that triggers the scale action.
   * @property {object} scaleAction the parameters for the scaling action.
   * @property {string} [scaleAction.direction] the scale direction. Whether
   * the scaling action increases or decreases the number of instances.
   * Possible values include: 'None', 'Increase', 'Decrease'
   * @property {string} [scaleAction.type] the type of action that should occur
   * when the scale rule fires. Possible values include: 'ChangeCount',
   * 'PercentChangeCount', 'ExactCount'
   * @property {string} [scaleAction.value] the number of instances that are
   * involved in the scaling action. This value must be 1 or greater. The
   * default value is 1.
   * @property {moment.duration} [scaleAction.cooldown] the amount of time to
   * wait since the last scaling action before this action occurs. It must be
   * between 1 week and 1 minute in ISO 8601 format.
   */
  constructor() {
  }

  /**
   * Defines the metadata of ScaleRule
   *
   * @returns {object} metadata of ScaleRule
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ScaleRule',
      type: {
        name: 'Composite',
        className: 'ScaleRule',
        modelProperties: {
          metricTrigger: {
            required: true,
            serializedName: 'metricTrigger',
            type: {
              name: 'Composite',
              className: 'MetricTrigger'
            }
          },
          scaleAction: {
            required: true,
            serializedName: 'scaleAction',
            type: {
              name: 'Composite',
              className: 'ScaleAction'
            }
          }
        }
      }
    };
  }
}

module.exports = ScaleRule;
