/*
 * 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 applications of a particular application
 * type. The application type applications evaluation can be returned when
 * cluster health evaluation returns unhealthy aggregated health state, either
 * Error or Warning. It contains health evaluations for each unhealthy
 * application of the included application type that impacted current
 * aggregated health state.
 *
 * @extends models['HealthEvaluation']
 */
class ApplicationTypeApplicationsHealthEvaluation extends models['HealthEvaluation'] {
  /**
   * Create a ApplicationTypeApplicationsHealthEvaluation.
   * @property {string} [applicationTypeName] The application type name as
   * defined in the application manifest.
   * @property {number} [maxPercentUnhealthyApplications] Maximum allowed
   * percentage of unhealthy applications for the application type, specified
   * as an entry in ApplicationTypeHealthPolicyMap.
   * @property {number} [totalCount] Total number of applications of the
   * application type found in the health store.
   * @property {array} [unhealthyEvaluations] List of unhealthy evaluations
   * that led to the aggregated health state. Includes all the unhealthy
   * ApplicationHealthEvaluation of this application type that impacted the
   * aggregated health.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of ApplicationTypeApplicationsHealthEvaluation
   *
   * @returns {object} metadata of ApplicationTypeApplicationsHealthEvaluation
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ApplicationTypeApplications',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'Kind',
          clientName: 'kind'
        },
        uberParent: 'HealthEvaluation',
        className: 'ApplicationTypeApplicationsHealthEvaluation',
        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'
            }
          },
          applicationTypeName: {
            required: false,
            serializedName: 'ApplicationTypeName',
            type: {
              name: 'String'
            }
          },
          maxPercentUnhealthyApplications: {
            required: false,
            serializedName: 'MaxPercentUnhealthyApplications',
            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 = ApplicationTypeApplicationsHealthEvaluation;
