/*
 * 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 information reported on a health entity, such as cluster,
 * application or node, with additional metadata added by the Health Manager.
 *
 * @extends models['HealthInformation']
 */
class HealthEvent extends models['HealthInformation'] {
  /**
   * Create a HealthEvent.
   * @property {boolean} [isExpired] Returns true if the health event is
   * expired, otherwise false.
   * @property {date} [sourceUtcTimestamp] The date and time when the health
   * report was sent by the source.
   * @property {date} [lastModifiedUtcTimestamp] The date and time when the
   * health report was last modified by the health store.
   * @property {date} [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} [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} [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 HealthEvent
   *
   * @returns {object} metadata of HealthEvent
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'HealthEvent',
      type: {
        name: 'Composite',
        className: 'HealthEvent',
        modelProperties: {
          sourceId: {
            required: true,
            serializedName: 'SourceId',
            type: {
              name: 'String'
            }
          },
          property: {
            required: true,
            serializedName: 'Property',
            type: {
              name: 'String'
            }
          },
          healthState: {
            required: true,
            serializedName: 'HealthState',
            type: {
              name: 'String'
            }
          },
          timeToLiveInMilliSeconds: {
            required: false,
            serializedName: 'TimeToLiveInMilliSeconds',
            type: {
              name: 'TimeSpan'
            }
          },
          description: {
            required: false,
            serializedName: 'Description',
            type: {
              name: 'String'
            }
          },
          sequenceNumber: {
            required: false,
            serializedName: 'SequenceNumber',
            type: {
              name: 'String'
            }
          },
          removeWhenExpired: {
            required: false,
            serializedName: 'RemoveWhenExpired',
            type: {
              name: 'Boolean'
            }
          },
          isExpired: {
            required: false,
            serializedName: 'IsExpired',
            type: {
              name: 'Boolean'
            }
          },
          sourceUtcTimestamp: {
            required: false,
            serializedName: 'SourceUtcTimestamp',
            type: {
              name: 'DateTime'
            }
          },
          lastModifiedUtcTimestamp: {
            required: false,
            serializedName: 'LastModifiedUtcTimestamp',
            type: {
              name: 'DateTime'
            }
          },
          lastOkTransitionAt: {
            required: false,
            serializedName: 'LastOkTransitionAt',
            type: {
              name: 'DateTime'
            }
          },
          lastWarningTransitionAt: {
            required: false,
            serializedName: 'LastWarningTransitionAt',
            type: {
              name: 'DateTime'
            }
          },
          lastErrorTransitionAt: {
            required: false,
            serializedName: 'LastErrorTransitionAt',
            type: {
              name: 'DateTime'
            }
          }
        }
      }
    };
  }
}

module.exports = HealthEvent;
