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

/**
 * A management event rule condition.
 *
 * @extends models['RuleCondition']
 */
class ManagementEventRuleCondition extends models['RuleCondition'] {
  /**
   * Create a ManagementEventRuleCondition.
   * @property {object} [aggregation] How the data that is collected should be
   * combined over time and when the alert is activated. Note that for
   * management event alerts aggregation is optional – if it is not provided
   * then any event will cause the alert to activate.
   * @property {string} [aggregation.operator] the condition operator. Possible
   * values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan',
   * 'LessThanOrEqual'
   * @property {number} [aggregation.threshold] The threshold value that
   * activates the alert.
   * @property {moment.duration} [aggregation.windowSize] the period of time
   * (in ISO 8601 duration format) that is used to monitor alert activity based
   * on the threshold. If specified then it must be between 5 minutes and 1
   * day.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of ManagementEventRuleCondition
   *
   * @returns {object} metadata of ManagementEventRuleCondition
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'odata.type',
          clientName: 'odatatype'
        },
        uberParent: 'RuleCondition',
        className: 'ManagementEventRuleCondition',
        modelProperties: {
          dataSource: {
            required: false,
            serializedName: 'dataSource',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: 'odata.type',
                clientName: 'odatatype'
              },
              uberParent: 'RuleDataSource',
              className: 'RuleDataSource'
            }
          },
          odatatype: {
            required: true,
            serializedName: 'odata\\.type',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          aggregation: {
            required: false,
            serializedName: 'aggregation',
            type: {
              name: 'Composite',
              className: 'ManagementEventAggregationCondition'
            }
          }
        }
      }
    };
  }
}

module.exports = ManagementEventRuleCondition;
