/*
 * 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 moment = require('moment');

/**
 * Describes the parameters for a standalone cluster configuration upgrade.
 *
 */
class ClusterConfigurationUpgradeDescription {
  /**
   * Create a ClusterConfigurationUpgradeDescription.
   * @property {string} clusterConfig The cluster configuration as a JSON
   * string. For example, [this
   * file](https://github.com/Azure-Samples/service-fabric-dotnet-standalone-cluster-configuration/blob/master/Samples/ClusterConfig.Unsecure.DevCluster.json)
   * contains JSON describing the [nodes and other properties of the
   * cluster](https://docs.microsoft.com/azure/service-fabric/service-fabric-cluster-manifest).
   * @property {moment.duration} [healthCheckRetryTimeout] The length of time
   * between attempts to perform health checks if the application or cluster is
   * not healthy. Default value: moment.duration('PT0H0M0S') .
   * @property {moment.duration} [healthCheckWaitDurationInSeconds] The length
   * of time to wait after completing an upgrade domain before starting the
   * health checks process. Default value: moment.duration('PT0H0M0S') .
   * @property {moment.duration} [healthCheckStableDurationInSeconds] The
   * length of time that the application or cluster must remain healthy before
   * the upgrade proceeds to the next upgrade domain. Default value:
   * moment.duration('PT0H0M0S') .
   * @property {moment.duration} [upgradeDomainTimeoutInSeconds] The timeout
   * for the upgrade domain. Default value: moment.duration('PT0H0M0S') .
   * @property {moment.duration} [upgradeTimeoutInSeconds] The upgrade timeout.
   * Default value: moment.duration('PT0H0M0S') .
   * @property {number} [maxPercentUnhealthyApplications] The maximum allowed
   * percentage of unhealthy applications during the upgrade. Allowed values
   * are integer values from zero to 100. Default value: 0 .
   * @property {number} [maxPercentUnhealthyNodes] The maximum allowed
   * percentage of unhealthy nodes during the upgrade. Allowed values are
   * integer values from zero to 100. Default value: 0 .
   * @property {number} [maxPercentDeltaUnhealthyNodes] The maximum allowed
   * percentage of delta health degradation during the upgrade. Allowed values
   * are integer values from zero to 100. Default value: 0 .
   * @property {number} [maxPercentUpgradeDomainDeltaUnhealthyNodes] The
   * maximum allowed percentage of upgrade domain delta health degradation
   * during the upgrade. Allowed values are integer values from zero to 100.
   * Default value: 0 .
   * @property {object} [applicationHealthPolicies] Defines the application
   * health policy map used to evaluate the health of an application or one of
   * its children entities.
   * @property {array} [applicationHealthPolicies.applicationHealthPolicyMap]
   * The wrapper that contains the map with application health policies used to
   * evaluate specific applications in the cluster.
   */
  constructor() {
  }

  /**
   * Defines the metadata of ClusterConfigurationUpgradeDescription
   *
   * @returns {object} metadata of ClusterConfigurationUpgradeDescription
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ClusterConfigurationUpgradeDescription',
      type: {
        name: 'Composite',
        className: 'ClusterConfigurationUpgradeDescription',
        modelProperties: {
          clusterConfig: {
            required: true,
            serializedName: 'ClusterConfig',
            type: {
              name: 'String'
            }
          },
          healthCheckRetryTimeout: {
            required: false,
            serializedName: 'HealthCheckRetryTimeout',
            defaultValue: moment.duration('PT0H0M0S'),
            type: {
              name: 'TimeSpan'
            }
          },
          healthCheckWaitDurationInSeconds: {
            required: false,
            serializedName: 'HealthCheckWaitDurationInSeconds',
            defaultValue: moment.duration('PT0H0M0S'),
            type: {
              name: 'TimeSpan'
            }
          },
          healthCheckStableDurationInSeconds: {
            required: false,
            serializedName: 'HealthCheckStableDurationInSeconds',
            defaultValue: moment.duration('PT0H0M0S'),
            type: {
              name: 'TimeSpan'
            }
          },
          upgradeDomainTimeoutInSeconds: {
            required: false,
            serializedName: 'UpgradeDomainTimeoutInSeconds',
            defaultValue: moment.duration('PT0H0M0S'),
            type: {
              name: 'TimeSpan'
            }
          },
          upgradeTimeoutInSeconds: {
            required: false,
            serializedName: 'UpgradeTimeoutInSeconds',
            defaultValue: moment.duration('PT0H0M0S'),
            type: {
              name: 'TimeSpan'
            }
          },
          maxPercentUnhealthyApplications: {
            required: false,
            serializedName: 'MaxPercentUnhealthyApplications',
            defaultValue: 0,
            type: {
              name: 'Number'
            }
          },
          maxPercentUnhealthyNodes: {
            required: false,
            serializedName: 'MaxPercentUnhealthyNodes',
            defaultValue: 0,
            type: {
              name: 'Number'
            }
          },
          maxPercentDeltaUnhealthyNodes: {
            required: false,
            serializedName: 'MaxPercentDeltaUnhealthyNodes',
            defaultValue: 0,
            type: {
              name: 'Number'
            }
          },
          maxPercentUpgradeDomainDeltaUnhealthyNodes: {
            required: false,
            serializedName: 'MaxPercentUpgradeDomainDeltaUnhealthyNodes',
            defaultValue: 0,
            type: {
              name: 'Number'
            }
          },
          applicationHealthPolicies: {
            required: false,
            serializedName: 'ApplicationHealthPolicies',
            type: {
              name: 'Composite',
              className: 'ApplicationHealthPolicies'
            }
          }
        }
      }
    };
  }
}

module.exports = ClusterConfigurationUpgradeDescription;
