/*
 * 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 alert.
 *
 * @extends models['BaseModel']
 */
class Alert extends models['BaseModel'] {
  /**
   * Create a Alert.
   * @member {string} title The title of the alert
   * @member {string} scope The scope of the alert. Possible values include:
   * 'Resource', 'Device'
   * @member {string} alertType The type of the alert
   * @member {date} appearedAtTime The UTC time at which the alert was raised
   * @member {date} appearedAtSourceTime The source time at which the alert was
   * raised
   * @member {date} [clearedAtTime] The UTC time at which the alert was cleared
   * @member {date} [clearedAtSourceTime] The source time at which the alert
   * was cleared
   * @member {object} source The source at which the alert was raised
   * @member {string} [source.name] The name of the source
   * @member {string} [source.timeZone] The time zone of the source
   * @member {string} [source.alertSourceType] The source type of the alert.
   * Possible values include: 'Resource', 'Device'
   * @member {string} [recommendation] The recommended action for the issue
   * raised in the alert
   * @member {string} [resolutionReason] The reason for resolving the alert
   * @member {string} severity The severity of the alert. Possible values
   * include: 'Informational', 'Warning', 'Critical'
   * @member {string} status The current status of the alert. Possible values
   * include: 'Active', 'Cleared'
   * @member {object} [errorDetails] The details of the error for which the
   * alert was raised
   * @member {string} [errorDetails.errorCode] The error code
   * @member {string} [errorDetails.errorMessage] The error message
   * @member {number} [errorDetails.occurences] The number of occurences
   * @member {object} [detailedInformation] More details about the alert
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of Alert
   *
   * @returns {object} metadata of Alert
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Alert',
      type: {
        name: 'Composite',
        className: 'Alert',
        modelProperties: {
          id: {
            required: false,
            readOnly: true,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          name: {
            required: false,
            readOnly: true,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          type: {
            required: false,
            readOnly: true,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          },
          kind: {
            required: false,
            serializedName: 'kind',
            type: {
              name: 'Enum',
              allowedValues: [ 'Series8000' ]
            }
          },
          title: {
            required: true,
            serializedName: 'properties.title',
            type: {
              name: 'String'
            }
          },
          scope: {
            required: true,
            serializedName: 'properties.scope',
            type: {
              name: 'Enum',
              allowedValues: [ 'Resource', 'Device' ]
            }
          },
          alertType: {
            required: true,
            serializedName: 'properties.alertType',
            type: {
              name: 'String'
            }
          },
          appearedAtTime: {
            required: true,
            serializedName: 'properties.appearedAtTime',
            type: {
              name: 'DateTime'
            }
          },
          appearedAtSourceTime: {
            required: true,
            serializedName: 'properties.appearedAtSourceTime',
            type: {
              name: 'DateTime'
            }
          },
          clearedAtTime: {
            required: false,
            serializedName: 'properties.clearedAtTime',
            type: {
              name: 'DateTime'
            }
          },
          clearedAtSourceTime: {
            required: false,
            serializedName: 'properties.clearedAtSourceTime',
            type: {
              name: 'DateTime'
            }
          },
          source: {
            required: true,
            serializedName: 'properties.source',
            type: {
              name: 'Composite',
              className: 'AlertSource'
            }
          },
          recommendation: {
            required: false,
            serializedName: 'properties.recommendation',
            type: {
              name: 'String'
            }
          },
          resolutionReason: {
            required: false,
            serializedName: 'properties.resolutionReason',
            type: {
              name: 'String'
            }
          },
          severity: {
            required: true,
            serializedName: 'properties.severity',
            type: {
              name: 'Enum',
              allowedValues: [ 'Informational', 'Warning', 'Critical' ]
            }
          },
          status: {
            required: true,
            serializedName: 'properties.status',
            type: {
              name: 'Enum',
              allowedValues: [ 'Active', 'Cleared' ]
            }
          },
          errorDetails: {
            required: false,
            serializedName: 'properties.errorDetails',
            type: {
              name: 'Composite',
              className: 'AlertErrorDetails'
            }
          },
          detailedInformation: {
            required: false,
            serializedName: 'properties.detailedInformation',
            type: {
              name: 'Dictionary',
              value: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          }
        }
      }
    };
  }
}

module.exports = Alert;
