/*
 * 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 for cluster nodes in an upgrade domain,
 * containing health evaluations for each unhealthy node that impacted current
 * aggregated health state. Can be returned when evaluating cluster health
 * during cluster upgrade and the aggregated health state is either Error or
 * Warning.
 *
 * @extends models['HealthEvaluation']
 */
class UpgradeDomainNodesHealthEvaluation extends models['HealthEvaluation'] {
  /**
   * Create a UpgradeDomainNodesHealthEvaluation.
   * @property {string} [upgradeDomainName] Name of the upgrade domain where
   * nodes health is currently evaluated.
   * @property {number} [maxPercentUnhealthyNodes] Maximum allowed percentage
   * of unhealthy nodes from the ClusterHealthPolicy.
   * @property {number} [totalCount] Total number of nodes in the current
   * upgrade domain.
   * @property {array} [unhealthyEvaluations] List of unhealthy evaluations
   * that led to the aggregated health state. Includes all the unhealthy
   * NodeHealthEvaluation that impacted the aggregated health.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of UpgradeDomainNodesHealthEvaluation
   *
   * @returns {object} metadata of UpgradeDomainNodesHealthEvaluation
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'UpgradeDomainNodes',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'Kind',
          clientName: 'kind'
        },
        uberParent: 'HealthEvaluation',
        className: 'UpgradeDomainNodesHealthEvaluation',
        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'
            }
          },
          upgradeDomainName: {
            required: false,
            serializedName: 'UpgradeDomainName',
            type: {
              name: 'String'
            }
          },
          maxPercentUnhealthyNodes: {
            required: false,
            serializedName: 'MaxPercentUnhealthyNodes',
            type: {
              name: 'Number'
            }
          },
          totalCount: {
            required: false,
            serializedName: 'TotalCount',
            type: {
              name: 'Number'
            }
          },
          unhealthyEvaluations: {
            required: false,
            serializedName: 'UnhealthyEvaluations',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'HealthEvaluationWrapperElementType',
                  type: {
                    name: 'Composite',
                    className: 'HealthEvaluationWrapper'
                  }
              }
            }
          }
        }
      }
    };
  }
}

module.exports = UpgradeDomainNodesHealthEvaluation;
