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

/**
 * Specify action need to be taken when rule type is Alert
 *
 * @extends models['Action']
 */
class AlertingAction extends models['Action'] {
  /**
   * Create a AlertingAction.
   * @property {string} severity Severity of the alert. Possible values
   * include: '0', '1', '2', '3', '4'
   * @property {object} [aznsAction] Azure action group reference.
   * @property {array} [aznsAction.actionGroup] Azure Action Group reference.
   * @property {string} [aznsAction.emailSubject] Custom subject override for
   * all email ids in Azure action group
   * @property {string} [aznsAction.customWebhookPayload] Custom payload to be
   * sent for all webhook URI in Azure action group
   * @property {number} [throttlingInMin] time (in minutes) for which Alerts
   * should be throttled or suppressed.
   * @property {object} trigger The trigger condition that results in the alert
   * rule being.
   * @property {string} [trigger.thresholdOperator] Evaluation operation for
   * rule - 'GreaterThan' or 'LessThan. Possible values include: 'GreaterThan',
   * 'LessThan', 'Equal'
   * @property {number} [trigger.threshold] Result or count threshold based on
   * which rule should be triggered.
   * @property {object} [trigger.metricTrigger] Trigger condition for metric
   * query rule
   * @property {string} [trigger.metricTrigger.thresholdOperator] Evaluation
   * operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible
   * values include: 'GreaterThan', 'LessThan', 'Equal'
   * @property {number} [trigger.metricTrigger.threshold] The threshold of the
   * metric trigger.
   * @property {string} [trigger.metricTrigger.metricTriggerType] Metric
   * Trigger Type - 'Consecutive' or 'Total'. Possible values include:
   * 'Consecutive', 'Total'
   * @property {string} [trigger.metricTrigger.metricColumn] Evaluation of
   * metric on a particular column
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of AlertingAction
   *
   * @returns {object} metadata of AlertingAction
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'odata.type',
          clientName: 'odatatype'
        },
        uberParent: 'Action',
        className: 'AlertingAction',
        modelProperties: {
          odatatype: {
            required: true,
            serializedName: 'odata\\.type',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          severity: {
            required: true,
            serializedName: 'severity',
            type: {
              name: 'String'
            }
          },
          aznsAction: {
            required: false,
            serializedName: 'aznsAction',
            type: {
              name: 'Composite',
              className: 'AzNsActionGroup'
            }
          },
          throttlingInMin: {
            required: false,
            serializedName: 'throttlingInMin',
            type: {
              name: 'Number'
            }
          },
          trigger: {
            required: true,
            serializedName: 'trigger',
            type: {
              name: 'Composite',
              className: 'TriggerCondition'
            }
          }
        }
      }
    };
  }
}

module.exports = AlertingAction;
