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

/**
 * Specifies the action to send email when the rule condition is evaluated. The
 * discriminator is always RuleEmailAction in this case.
 *
 * @extends models['RuleAction']
 */
class RuleEmailAction extends models['RuleAction'] {
  /**
   * Create a RuleEmailAction.
   * @property {boolean} [sendToServiceOwners] Whether the administrators
   * (service and co-administrators) of the service should be notified when the
   * alert is activated.
   * @property {array} [customEmails] the list of administrator's custom email
   * addresses to notify of the activation of the alert.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of RuleEmailAction
   *
   * @returns {object} metadata of RuleEmailAction
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Microsoft.Azure.Management.Insights.Models.RuleEmailAction',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'odata.type',
          clientName: 'odatatype'
        },
        uberParent: 'RuleAction',
        className: 'RuleEmailAction',
        modelProperties: {
          odatatype: {
            required: true,
            serializedName: 'odata\\.type',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          sendToServiceOwners: {
            required: false,
            serializedName: 'sendToServiceOwners',
            type: {
              name: 'Boolean'
            }
          },
          customEmails: {
            required: false,
            serializedName: 'customEmails',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          }
        }
      }
    };
  }
}

module.exports = RuleEmailAction;
