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

/**
 * Peerings in a virtual network resource.
 *
 * @extends models['SubResource']
 */
class VirtualNetworkPeering extends models['SubResource'] {
  /**
   * Create a VirtualNetworkPeering.
   * @property {boolean} [allowVirtualNetworkAccess] Whether the VMs in the
   * local virtual network space would be able to access the VMs in remote
   * virtual network space.
   * @property {boolean} [allowForwardedTraffic] Whether the forwarded traffic
   * from the VMs in the local virtual network will be allowed/disallowed in
   * remote virtual network.
   * @property {boolean} [allowGatewayTransit] If gateway links can be used in
   * remote virtual networking to link to this virtual network.
   * @property {boolean} [useRemoteGateways] If remote gateways can be used on
   * this virtual network. If the flag is set to true, and allowGatewayTransit
   * on remote peering is also true, virtual network will use gateways of
   * remote virtual network for transit. Only one peering can have this flag
   * set to true. This flag cannot be set if virtual network already has a
   * gateway.
   * @property {object} [remoteVirtualNetwork] The reference of the remote
   * virtual network. The remote virtual network can be in the same or
   * different region (preview). See here to register for the preview and learn
   * more
   * (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering).
   * @property {string} [remoteVirtualNetwork.id] Resource ID.
   * @property {object} [remoteAddressSpace] The reference of the remote
   * virtual network address space.
   * @property {array} [remoteAddressSpace.addressPrefixes] A list of address
   * blocks reserved for this virtual network in CIDR notation.
   * @property {string} [peeringState] The status of the virtual network
   * peering. Possible values are 'Initiated', 'Connected', and 'Disconnected'.
   * Possible values include: 'Initiated', 'Connected', 'Disconnected'
   * @property {string} [provisioningState] The provisioning state of the
   * resource.
   * @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 VirtualNetworkPeering
   *
   * @returns {object} metadata of VirtualNetworkPeering
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'VirtualNetworkPeering',
      type: {
        name: 'Composite',
        className: 'VirtualNetworkPeering',
        modelProperties: {
          id: {
            required: false,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          allowVirtualNetworkAccess: {
            required: false,
            serializedName: 'properties.allowVirtualNetworkAccess',
            type: {
              name: 'Boolean'
            }
          },
          allowForwardedTraffic: {
            required: false,
            serializedName: 'properties.allowForwardedTraffic',
            type: {
              name: 'Boolean'
            }
          },
          allowGatewayTransit: {
            required: false,
            serializedName: 'properties.allowGatewayTransit',
            type: {
              name: 'Boolean'
            }
          },
          useRemoteGateways: {
            required: false,
            serializedName: 'properties.useRemoteGateways',
            type: {
              name: 'Boolean'
            }
          },
          remoteVirtualNetwork: {
            required: false,
            serializedName: 'properties.remoteVirtualNetwork',
            type: {
              name: 'Composite',
              className: 'SubResource'
            }
          },
          remoteAddressSpace: {
            required: false,
            serializedName: 'properties.remoteAddressSpace',
            type: {
              name: 'Composite',
              className: 'AddressSpace'
            }
          },
          peeringState: {
            required: false,
            serializedName: 'properties.peeringState',
            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 = VirtualNetworkPeering;
