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

/**
 * Health information common to all entities in the cluster. It contains the
 * aggregated health state, health events and unhealthy evaluation.
 *
 */
class EntityHealth {
  /**
   * Create a EntityHealth.
   * @property {string} [aggregatedHealthState] The HealthState representing
   * the aggregated health state of the entity computed by Health Manager.
   * The health evaluation of the entity reflects all events reported on the
   * entity and its children (if any).
   * The aggregation is done by applying the desired health policy. Possible
   * values include: 'Invalid', 'Ok', 'Warning', 'Error', 'Unknown'
   * @property {array} [healthEvents] The list of health events reported on the
   * entity.
   * @property {array} [unhealthyEvaluations] The unhealthy evaluations that
   * show why the current aggregated health state was returned by Health
   * Manager.
   * @property {object} [healthStatistics] Shows the health statistics for all
   * children types of the queried entity.
   * @property {array} [healthStatistics.healthStateCountList] List of health
   * state counts per entity kind, which keeps track of how many children of
   * the queried entity are in Ok, Warning and Error state.
   */
  constructor() {
  }

  /**
   * Defines the metadata of EntityHealth
   *
   * @returns {object} metadata of EntityHealth
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'EntityHealth',
      type: {
        name: 'Composite',
        className: 'EntityHealth',
        modelProperties: {
          aggregatedHealthState: {
            required: false,
            serializedName: 'AggregatedHealthState',
            type: {
              name: 'String'
            }
          },
          healthEvents: {
            required: false,
            serializedName: 'HealthEvents',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'HealthEventElementType',
                  type: {
                    name: 'Composite',
                    className: 'HealthEvent'
                  }
              }
            }
          },
          unhealthyEvaluations: {
            required: false,
            serializedName: 'UnhealthyEvaluations',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'HealthEvaluationWrapperElementType',
                  type: {
                    name: 'Composite',
                    className: 'HealthEvaluationWrapper'
                  }
              }
            }
          },
          healthStatistics: {
            required: false,
            serializedName: 'HealthStatistics',
            type: {
              name: 'Composite',
              className: 'HealthStatistics'
            }
          }
        }
      }
    };
  }
}

module.exports = EntityHealth;
