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

/**
 * Backend address pool settings of an application gateway.
 *
 * @extends models['SubResource']
 */
class ApplicationGatewayBackendHttpSettings extends models['SubResource'] {
  /**
   * Create a ApplicationGatewayBackendHttpSettings.
   * @property {number} [port] The destination port on the backend.
   * @property {string} [protocol] The protocol used to communicate with the
   * backend. Possible values include: 'Http', 'Https'
   * @property {string} [cookieBasedAffinity] Cookie based affinity. Possible
   * values include: 'Enabled', 'Disabled'
   * @property {number} [requestTimeout] Request timeout in seconds.
   * Application Gateway will fail the request if response is not received
   * within RequestTimeout. Acceptable values are from 1 second to 86400
   * seconds.
   * @property {object} [probe] Probe resource of an application gateway.
   * @property {string} [probe.id] Resource ID.
   * @property {array} [authenticationCertificates] Array of references to
   * application gateway authentication certificates.
   * @property {array} [trustedRootCertificates] Array of references to
   * application gateway trusted root certificates.
   * @property {object} [connectionDraining] Connection draining of the backend
   * http settings resource.
   * @property {boolean} [connectionDraining.enabled] Whether connection
   * draining is enabled or not.
   * @property {number} [connectionDraining.drainTimeoutInSec] The number of
   * seconds connection draining is active. Acceptable values are from 1 second
   * to 3600 seconds.
   * @property {string} [hostName] Host header to be sent to the backend
   * servers.
   * @property {boolean} [pickHostNameFromBackendAddress] Whether to pick host
   * header should be picked from the host name of the backend server. Default
   * value is false.
   * @property {string} [affinityCookieName] Cookie name to use for the
   * affinity cookie.
   * @property {boolean} [probeEnabled] Whether the probe is enabled. Default
   * value is false.
   * @property {string} [path] Path which should be used as a prefix for all
   * HTTP requests. Null means no path will be prefixed. Default value is null.
   * @property {string} [provisioningState] Provisioning state of the backend
   * http settings resource. Possible values are: 'Updating', 'Deleting', and
   * 'Failed'.
   * @property {string} [name] Name of the backend http settings that is unique
   * within an Application Gateway.
   * @property {string} [etag] A unique read-only string that changes whenever
   * the resource is updated.
   * @property {string} [type] Type of the resource.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of ApplicationGatewayBackendHttpSettings
   *
   * @returns {object} metadata of ApplicationGatewayBackendHttpSettings
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ApplicationGatewayBackendHttpSettings',
      type: {
        name: 'Composite',
        className: 'ApplicationGatewayBackendHttpSettings',
        modelProperties: {
          id: {
            required: false,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          port: {
            required: false,
            serializedName: 'properties.port',
            type: {
              name: 'Number'
            }
          },
          protocol: {
            required: false,
            serializedName: 'properties.protocol',
            type: {
              name: 'String'
            }
          },
          cookieBasedAffinity: {
            required: false,
            serializedName: 'properties.cookieBasedAffinity',
            type: {
              name: 'String'
            }
          },
          requestTimeout: {
            required: false,
            serializedName: 'properties.requestTimeout',
            type: {
              name: 'Number'
            }
          },
          probe: {
            required: false,
            serializedName: 'properties.probe',
            type: {
              name: 'Composite',
              className: 'SubResource'
            }
          },
          authenticationCertificates: {
            required: false,
            serializedName: 'properties.authenticationCertificates',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'SubResourceElementType',
                  type: {
                    name: 'Composite',
                    className: 'SubResource'
                  }
              }
            }
          },
          trustedRootCertificates: {
            required: false,
            serializedName: 'properties.trustedRootCertificates',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'SubResourceElementType',
                  type: {
                    name: 'Composite',
                    className: 'SubResource'
                  }
              }
            }
          },
          connectionDraining: {
            required: false,
            serializedName: 'properties.connectionDraining',
            type: {
              name: 'Composite',
              className: 'ApplicationGatewayConnectionDraining'
            }
          },
          hostName: {
            required: false,
            serializedName: 'properties.hostName',
            type: {
              name: 'String'
            }
          },
          pickHostNameFromBackendAddress: {
            required: false,
            serializedName: 'properties.pickHostNameFromBackendAddress',
            type: {
              name: 'Boolean'
            }
          },
          affinityCookieName: {
            required: false,
            serializedName: 'properties.affinityCookieName',
            type: {
              name: 'String'
            }
          },
          probeEnabled: {
            required: false,
            serializedName: 'properties.probeEnabled',
            type: {
              name: 'Boolean'
            }
          },
          path: {
            required: false,
            serializedName: 'properties.path',
            type: {
              name: 'String'
            }
          },
          provisioningState: {
            required: false,
            serializedName: 'properties.provisioningState',
            type: {
              name: 'String'
            }
          },
          name: {
            required: false,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          etag: {
            required: false,
            serializedName: 'etag',
            type: {
              name: 'String'
            }
          },
          type: {
            required: false,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = ApplicationGatewayBackendHttpSettings;
