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

/**
 * Represents a scaling trigger related to an average load of a metric/resource
 * of a partition.
 *
 * @extends models['ScalingTriggerDescription']
 */
class AveragePartitionLoadScalingTrigger extends models['ScalingTriggerDescription'] {
  /**
   * Create a AveragePartitionLoadScalingTrigger.
   * @property {string} metricName The name of the metric for which usage
   * should be tracked.
   * @property {string} lowerLoadThreshold The lower limit of the load below
   * which a scale in operation should be performed.
   * @property {string} upperLoadThreshold The upper limit of the load beyond
   * which a scale out operation should be performed.
   * @property {number} scaleIntervalInSeconds The period in seconds on which a
   * decision is made whether to scale or not.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of AveragePartitionLoadScalingTrigger
   *
   * @returns {object} metadata of AveragePartitionLoadScalingTrigger
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'AveragePartitionLoad',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'Kind',
          clientName: 'kind'
        },
        uberParent: 'ScalingTriggerDescription',
        className: 'AveragePartitionLoadScalingTrigger',
        modelProperties: {
          kind: {
            required: true,
            serializedName: 'Kind',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          metricName: {
            required: true,
            serializedName: 'MetricName',
            type: {
              name: 'String'
            }
          },
          lowerLoadThreshold: {
            required: true,
            serializedName: 'LowerLoadThreshold',
            type: {
              name: 'String'
            }
          },
          upperLoadThreshold: {
            required: true,
            serializedName: 'UpperLoadThreshold',
            type: {
              name: 'String'
            }
          },
          scaleIntervalInSeconds: {
            required: true,
            serializedName: 'ScaleIntervalInSeconds',
            constraints: {
              InclusiveMaximum: 4294967295,
              InclusiveMinimum: 0
            },
            type: {
              name: 'Number'
            }
          }
        }
      }
    };
  }
}

module.exports = AveragePartitionLoadScalingTrigger;
