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

/**
 * A load balancer probe.
 *
 * @extends models['SubResource']
 */
class Probe extends models['SubResource'] {
  /**
   * Create a Probe.
   * @property {array} [loadBalancingRules] The load balancer rules that use
   * this probe.
   * @property {string} protocol The protocol of the end point. Possible values
   * are: 'Http', 'Tcp', or 'Https'. If 'Tcp' is specified, a received ACK is
   * required for the probe to be successful. If 'Http' or 'Https' is
   * specified, a 200 OK response from the specifies URI is required for the
   * probe to be successful. Possible values include: 'Http', 'Tcp', 'Https'
   * @property {number} port The port for communicating the probe. Possible
   * values range from 1 to 65535, inclusive.
   * @property {number} [intervalInSeconds] The interval, in seconds, for how
   * frequently to probe the endpoint for health status. Typically, the
   * interval is slightly less than half the allocated timeout period (in
   * seconds) which allows two full probes before taking the instance out of
   * rotation. The default value is 15, the minimum value is 5.
   * @property {number} [numberOfProbes] The number of probes where if no
   * response, will result in stopping further traffic from being delivered to
   * the endpoint. This values allows endpoints to be taken out of rotation
   * faster or slower than the typical times used in Azure.
   * @property {string} [requestPath] The URI used for requesting health status
   * from the VM. Path is required if a protocol is set to http. Otherwise, it
   * is not allowed. There is no default value.
   * @property {string} [provisioningState] Gets the provisioning state of the
   * public IP resource. Possible values are: 'Updating', 'Deleting', and
   * 'Failed'.
   * @property {string} [name] Gets name of the resource that is unique within
   * a resource group. This name can be used to access the resource.
   * @property {string} [etag] A unique read-only string that changes whenever
   * the resource is updated.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of Probe
   *
   * @returns {object} metadata of Probe
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Probe',
      type: {
        name: 'Composite',
        className: 'Probe',
        modelProperties: {
          id: {
            required: false,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          loadBalancingRules: {
            required: false,
            readOnly: true,
            serializedName: 'properties.loadBalancingRules',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'SubResourceElementType',
                  type: {
                    name: 'Composite',
                    className: 'SubResource'
                  }
              }
            }
          },
          protocol: {
            required: true,
            serializedName: 'properties.protocol',
            type: {
              name: 'String'
            }
          },
          port: {
            required: true,
            serializedName: 'properties.port',
            type: {
              name: 'Number'
            }
          },
          intervalInSeconds: {
            required: false,
            serializedName: 'properties.intervalInSeconds',
            type: {
              name: 'Number'
            }
          },
          numberOfProbes: {
            required: false,
            serializedName: 'properties.numberOfProbes',
            type: {
              name: 'Number'
            }
          },
          requestPath: {
            required: false,
            serializedName: 'properties.requestPath',
            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'
            }
          }
        }
      }
    };
  }
}

module.exports = Probe;
