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

/**
 * Outbound pool of the load balancer.
 *
 * @extends models['SubResource']
 */
class OutboundRule extends models['SubResource'] {
  /**
   * Create a OutboundRule.
   * @property {number} [allocatedOutboundPorts] The number of outbound ports
   * to be used for NAT.
   * @property {array} frontendIPConfigurations The Frontend IP addresses of
   * the load balancer.
   * @property {object} backendAddressPool A reference to a pool of DIPs.
   * Outbound traffic is randomly load balanced across IPs in the backend IPs.
   * @property {string} [backendAddressPool.id] Resource ID.
   * @property {string} [provisioningState] Gets the provisioning state of the
   * PublicIP resource. Possible values are: 'Updating', 'Deleting', and
   * 'Failed'.
   * @property {string} protocol The protocol for the outbound rule in load
   * balancer. Possible values are: 'Tcp', 'Udp', and 'All'. Possible values
   * include: 'Tcp', 'Udp', 'All'
   * @property {boolean} [enableTcpReset] Receive bidirectional TCP Reset on
   * TCP flow idle timeout or unexpected connection termination. This element
   * is only used when the protocol is set to TCP.
   * @property {number} [idleTimeoutInMinutes] The timeout for the TCP idle
   * connection
   * @property {string} [name] The 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 OutboundRule
   *
   * @returns {object} metadata of OutboundRule
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'OutboundRule',
      type: {
        name: 'Composite',
        className: 'OutboundRule',
        modelProperties: {
          id: {
            required: false,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          allocatedOutboundPorts: {
            required: false,
            serializedName: 'properties.allocatedOutboundPorts',
            type: {
              name: 'Number'
            }
          },
          frontendIPConfigurations: {
            required: true,
            serializedName: 'properties.frontendIPConfigurations',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'SubResourceElementType',
                  type: {
                    name: 'Composite',
                    className: 'SubResource'
                  }
              }
            }
          },
          backendAddressPool: {
            required: true,
            serializedName: 'properties.backendAddressPool',
            type: {
              name: 'Composite',
              className: 'SubResource'
            }
          },
          provisioningState: {
            required: false,
            serializedName: 'properties.provisioningState',
            type: {
              name: 'String'
            }
          },
          protocol: {
            required: true,
            serializedName: 'properties.protocol',
            type: {
              name: 'String'
            }
          },
          enableTcpReset: {
            required: false,
            serializedName: 'properties.enableTcpReset',
            type: {
              name: 'Boolean'
            }
          },
          idleTimeoutInMinutes: {
            required: false,
            serializedName: 'properties.idleTimeoutInMinutes',
            type: {
              name: 'Number'
            }
          },
          name: {
            required: false,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          etag: {
            required: false,
            serializedName: 'etag',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = OutboundRule;
