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

/**
 * Describes the average load trigger used for auto scaling.
 *
 * @extends models['AutoScalingTrigger']
 */
class AverageLoadScalingTrigger extends models['AutoScalingTrigger'] {
  /**
   * Create a AverageLoadScalingTrigger.
   * @property {object} metric Description of the metric that is used for
   * scaling.
   * @property {string} [metric.kind] Polymorphic Discriminator
   * @property {number} lowerLoadThreshold Lower load threshold (if average
   * load is below this threshold, service will scale down).
   * @property {number} upperLoadThreshold Upper load threshold (if average
   * load is above this threshold, service will scale up).
   * @property {number} scaleIntervalInSeconds Scale interval that indicates
   * how often will this trigger be checked.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of AverageLoadScalingTrigger
   *
   * @returns {object} metadata of AverageLoadScalingTrigger
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'AverageLoad',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'kind',
          clientName: 'kind'
        },
        uberParent: 'AutoScalingTrigger',
        className: 'AverageLoadScalingTrigger',
        modelProperties: {
          kind: {
            required: true,
            serializedName: 'kind',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          metric: {
            required: true,
            serializedName: 'metric',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: 'kind',
                clientName: 'kind'
              },
              uberParent: 'AutoScalingMetric',
              className: 'AutoScalingMetric'
            }
          },
          lowerLoadThreshold: {
            required: true,
            serializedName: 'lowerLoadThreshold',
            type: {
              name: 'Number'
            }
          },
          upperLoadThreshold: {
            required: true,
            serializedName: 'upperLoadThreshold',
            type: {
              name: 'Number'
            }
          },
          scaleIntervalInSeconds: {
            required: true,
            serializedName: 'scaleIntervalInSeconds',
            constraints: {
              InclusiveMinimum: 60
            },
            type: {
              name: 'Number'
            }
          }
        }
      }
    };
  }
}

module.exports = AverageLoadScalingTrigger;
