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

/**
 * The metric alert resource for patch operations.
 *
 */
class MetricAlertResourcePatch {
  /**
   * Create a MetricAlertResourcePatch.
   * @member {object} [tags] Resource tags
   * @member {string} description the description of the metric alert that will
   * be included in the alert email.
   * @member {number} severity Alert severity {0, 1, 2, 3, 4}
   * @member {boolean} enabled the flag that indicates whether the metric alert
   * is enabled.
   * @member {array} [scopes] the list of resource id's that this metric alert
   * is scoped to.
   * @member {moment.duration} evaluationFrequency how often the metric alert
   * is evaluated represented in ISO 8601 duration format.
   * @member {moment.duration} windowSize the period of time (in ISO 8601
   * duration format) that is used to monitor alert activity based on the
   * threshold.
   * @member {object} criteria defines the specific alert criteria information.
   * @member {string} [criteria.odatatype] Polymorphic Discriminator
   * @member {array} [actions] the array of actions that are performed when the
   * alert rule becomes active, and when an alert condition is resolved.
   * @member {date} [lastUpdatedTime] Last time the rule was updated in ISO8601
   * format.
   */
  constructor() {
  }

  /**
   * Defines the metadata of MetricAlertResourcePatch
   *
   * @returns {object} metadata of MetricAlertResourcePatch
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'MetricAlertResourcePatch',
      type: {
        name: 'Composite',
        className: 'MetricAlertResourcePatch',
        modelProperties: {
          tags: {
            required: false,
            serializedName: 'tags',
            type: {
              name: 'Dictionary',
              value: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          description: {
            required: true,
            serializedName: 'properties.description',
            type: {
              name: 'String'
            }
          },
          severity: {
            required: true,
            serializedName: 'properties.severity',
            type: {
              name: 'Number'
            }
          },
          enabled: {
            required: true,
            serializedName: 'properties.enabled',
            type: {
              name: 'Boolean'
            }
          },
          scopes: {
            required: false,
            serializedName: 'properties.scopes',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          evaluationFrequency: {
            required: true,
            serializedName: 'properties.evaluationFrequency',
            type: {
              name: 'TimeSpan'
            }
          },
          windowSize: {
            required: true,
            serializedName: 'properties.windowSize',
            type: {
              name: 'TimeSpan'
            }
          },
          criteria: {
            required: true,
            serializedName: 'properties.criteria',
            type: {
              name: 'Composite',
              additionalProperties: {
                type: {
                  name: 'Dictionary',
                  value: {
                      required: false,
                      serializedName: 'ObjectElementType',
                      type: {
                        name: 'Object'
                      }
                  }
                }
              },
              polymorphicDiscriminator: {
                serializedName: 'odata.type',
                clientName: 'odatatype'
              },
              uberParent: 'MetricAlertCriteria',
              className: 'MetricAlertCriteria'
            }
          },
          actions: {
            required: false,
            serializedName: 'properties.actions',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'ActionElementType',
                  type: {
                    name: 'Composite',
                    className: 'Action'
                  }
              }
            }
          },
          lastUpdatedTime: {
            required: false,
            readOnly: true,
            serializedName: 'properties.lastUpdatedTime',
            type: {
              name: 'DateTime'
            }
          }
        }
      }
    };
  }
}

module.exports = MetricAlertResourcePatch;
