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

/**
 * Represents health evaluation of a HealthEvent that was reported on the
 * entity.
 * The health evaluation is returned when evaluating health of an entity
 * results in Error or Warning.
 *
 * @extends models['HealthEvaluation']
 */
class EventHealthEvaluation extends models['HealthEvaluation'] {
  /**
   * Create a EventHealthEvaluation.
   * @property {boolean} [considerWarningAsError] Indicates whether warnings
   * are treated with the same severity as errors. The field is specified in
   * the health policy used to evaluate the entity.
   * @property {object} [unhealthyEvent] Represents health information reported
   * on a health entity, such as cluster, application or node, with additional
   * metadata added by the Health Manager.
   * @property {boolean} [unhealthyEvent.isExpired] Returns true if the health
   * event is expired, otherwise false.
   * @property {date} [unhealthyEvent.sourceUtcTimestamp] The date and time
   * when the health report was sent by the source.
   * @property {date} [unhealthyEvent.lastModifiedUtcTimestamp] The date and
   * time when the health report was last modified by the health store.
   * @property {date} [unhealthyEvent.lastOkTransitionAt] If the current health
   * state is 'Ok', this property returns the time at which the health report
   * was first reported with 'Ok'.
   * For periodic reporting, many reports with the same state may have been
   * generated.
   * This property returns the date and time when the first 'Ok' health report
   * was received.
   *
   * If the current health state is 'Error' or 'Warning', returns the date and
   * time at which the health state was last in 'Ok', before transitioning to a
   * different state.
   *
   * If the health state was never 'Ok', the value will be zero date-time.
   * @property {date} [unhealthyEvent.lastWarningTransitionAt] If the current
   * health state is 'Warning', this property returns the time at which the
   * health report was first reported with 'Warning'. For periodic reporting,
   * many reports with the same state may have been generated however, this
   * property returns only the date and time at the first 'Warning' health
   * report was received.
   *
   * If the current health state is 'Ok' or 'Error', returns the date and time
   * at which the health state was last in 'Warning', before transitioning to a
   * different state.
   *
   * If the health state was never 'Warning', the value will be zero date-time.
   * @property {date} [unhealthyEvent.lastErrorTransitionAt] If the current
   * health state is 'Error', this property returns the time at which the
   * health report was first reported with 'Error'. For periodic reporting,
   * many reports with the same state may have been generated however, this
   * property returns only the date and time at the first 'Error' health report
   * was received.
   *
   * If the current health state is 'Ok' or 'Warning', returns the date and
   * time at which the health state was last in 'Error', before transitioning
   * to a different state.
   *
   * If the health state was never 'Error', the value will be zero date-time.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of EventHealthEvaluation
   *
   * @returns {object} metadata of EventHealthEvaluation
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Event',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'Kind',
          clientName: 'kind'
        },
        uberParent: 'HealthEvaluation',
        className: 'EventHealthEvaluation',
        modelProperties: {
          aggregatedHealthState: {
            required: false,
            serializedName: 'AggregatedHealthState',
            type: {
              name: 'String'
            }
          },
          description: {
            required: false,
            serializedName: 'Description',
            type: {
              name: 'String'
            }
          },
          kind: {
            required: true,
            serializedName: 'Kind',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          considerWarningAsError: {
            required: false,
            serializedName: 'ConsiderWarningAsError',
            type: {
              name: 'Boolean'
            }
          },
          unhealthyEvent: {
            required: false,
            serializedName: 'UnhealthyEvent',
            type: {
              name: 'Composite',
              className: 'HealthEvent'
            }
          }
        }
      }
    };
  }
}

module.exports = EventHealthEvaluation;
