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

/**
 * The metric alert resource for patch operations.
 *
 */
class MetricAlertResourcePatch {
  /**
   * Create a MetricAlertResourcePatch.
   * @property {object} [tags] Resource tags
   * @property {string} description the description of the metric alert that
   * will be included in the alert email.
   * @property {number} severity Alert severity {0, 1, 2, 3, 4}
   * @property {boolean} enabled the flag that indicates whether the metric
   * alert is enabled.
   * @property {array} [scopes] the list of resource id's that this metric
   * alert is scoped to.
   * @property {moment.duration} evaluationFrequency how often the metric alert
   * is evaluated represented in ISO 8601 duration format.
   * @property {moment.duration} windowSize the period of time (in ISO 8601
   * duration format) that is used to monitor alert activity based on the
   * threshold.
   * @property {string} [targetResourceType] the resource type of the target
   * resource(s) on which the alert is created/updated. Mandatory for
   * MultipleResourceMultipleMetricCriteria.
   * @property {string} [targetResourceRegion] the region of the target
   * resource(s) on which the alert is created/updated. Mandatory for
   * MultipleResourceMultipleMetricCriteria.
   * @property {object} criteria defines the specific alert criteria
   * information.
   * @property {string} [criteria.odatatype] Polymorphic Discriminator
   * @property {boolean} [autoMitigate] the flag that indicates whether the
   * alert should be auto resolved or not.
   * @property {array} [actions] the array of actions that are performed when
   * the alert rule becomes active, and when an alert condition is resolved.
   * @property {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'
            }
          },
          targetResourceType: {
            required: false,
            serializedName: 'properties.targetResourceType',
            type: {
              name: 'String'
            }
          },
          targetResourceRegion: {
            required: false,
            serializedName: 'properties.targetResourceRegion',
            type: {
              name: 'String'
            }
          },
          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'
            }
          },
          autoMitigate: {
            required: false,
            serializedName: 'properties.autoMitigate',
            type: {
              name: 'Boolean'
            }
          },
          actions: {
            required: false,
            serializedName: 'properties.actions',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'MetricAlertActionElementType',
                  type: {
                    name: 'Composite',
                    className: 'MetricAlertAction'
                  }
              }
            }
          },
          lastUpdatedTime: {
            required: false,
            readOnly: true,
            serializedName: 'properties.lastUpdatedTime',
            type: {
              name: 'DateTime'
            }
          }
        }
      }
    };
  }
}

module.exports = MetricAlertResourcePatch;
