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

/**
 * Subnet in a virtual network resource.
 *
 * @extends models['SubResource']
 */
class Subnet extends models['SubResource'] {
  /**
   * Create a Subnet.
   * @property {string} [addressPrefix] The address prefix for the subnet.
   * @property {array} [addressPrefixes] List of  address prefixes for the
   * subnet.
   * @property {object} [networkSecurityGroup] The reference of the
   * NetworkSecurityGroup resource.
   * @property {array} [networkSecurityGroup.securityRules] A collection of
   * security rules of the network security group.
   * @property {array} [networkSecurityGroup.defaultSecurityRules] The default
   * security rules of network security group.
   * @property {array} [networkSecurityGroup.networkInterfaces] A collection of
   * references to network interfaces.
   * @property {array} [networkSecurityGroup.subnets] A collection of
   * references to subnets.
   * @property {string} [networkSecurityGroup.resourceGuid] The resource GUID
   * property of the network security group resource.
   * @property {string} [networkSecurityGroup.provisioningState] The
   * provisioning state of the public IP resource. Possible values are:
   * 'Updating', 'Deleting', and 'Failed'.
   * @property {string} [networkSecurityGroup.etag] A unique read-only string
   * that changes whenever the resource is updated.
   * @property {object} [routeTable] The reference of the RouteTable resource.
   * @property {array} [routeTable.routes] Collection of routes contained
   * within a route table.
   * @property {array} [routeTable.subnets] A collection of references to
   * subnets.
   * @property {boolean} [routeTable.disableBgpRoutePropagation] Gets or sets
   * whether to disable the routes learned by BGP on that route table. True
   * means disable.
   * @property {string} [routeTable.provisioningState] The provisioning state
   * of the resource. Possible values are: 'Updating', 'Deleting', and
   * 'Failed'.
   * @property {string} [routeTable.etag] Gets a unique read-only string that
   * changes whenever the resource is updated.
   * @property {object} [natGateway] Nat gateway associated with this subnet.
   * @property {string} [natGateway.id] Resource ID.
   * @property {array} [serviceEndpoints] An array of service endpoints.
   * @property {array} [serviceEndpointPolicies] An array of service endpoint
   * policies.
   * @property {array} [interfaceEndpoints] An array of references to interface
   * endpoints
   * @property {array} [ipConfigurations] Gets an array of references to the
   * network interface IP configurations using subnet.
   * @property {array} [ipConfigurationProfiles] Array of IP configuration
   * profiles which reference this subnet.
   * @property {array} [resourceNavigationLinks] Gets an array of references to
   * the external resources using subnet.
   * @property {array} [serviceAssociationLinks] Gets an array of references to
   * services injecting into this subnet.
   * @property {array} [delegations] Gets an array of references to the
   * delegations on the subnet.
   * @property {string} [purpose] A read-only string identifying the intention
   * of use for this subnet based on delegations and other user-defined
   * properties.
   * @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 Subnet
   *
   * @returns {object} metadata of Subnet
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Subnet',
      type: {
        name: 'Composite',
        className: 'Subnet',
        modelProperties: {
          id: {
            required: false,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          addressPrefix: {
            required: false,
            serializedName: 'properties.addressPrefix',
            type: {
              name: 'String'
            }
          },
          addressPrefixes: {
            required: false,
            serializedName: 'properties.addressPrefixes',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          networkSecurityGroup: {
            required: false,
            serializedName: 'properties.networkSecurityGroup',
            type: {
              name: 'Composite',
              className: 'NetworkSecurityGroup'
            }
          },
          routeTable: {
            required: false,
            serializedName: 'properties.routeTable',
            type: {
              name: 'Composite',
              className: 'RouteTable'
            }
          },
          natGateway: {
            required: false,
            serializedName: 'properties.natGateway',
            type: {
              name: 'Composite',
              className: 'SubResource'
            }
          },
          serviceEndpoints: {
            required: false,
            serializedName: 'properties.serviceEndpoints',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'ServiceEndpointPropertiesFormatElementType',
                  type: {
                    name: 'Composite',
                    className: 'ServiceEndpointPropertiesFormat'
                  }
              }
            }
          },
          serviceEndpointPolicies: {
            required: false,
            serializedName: 'properties.serviceEndpointPolicies',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'ServiceEndpointPolicyElementType',
                  type: {
                    name: 'Composite',
                    className: 'ServiceEndpointPolicy'
                  }
              }
            }
          },
          interfaceEndpoints: {
            required: false,
            readOnly: true,
            serializedName: 'properties.interfaceEndpoints',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'InterfaceEndpointElementType',
                  type: {
                    name: 'Composite',
                    className: 'InterfaceEndpoint'
                  }
              }
            }
          },
          ipConfigurations: {
            required: false,
            readOnly: true,
            serializedName: 'properties.ipConfigurations',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'IPConfigurationElementType',
                  type: {
                    name: 'Composite',
                    className: 'IPConfiguration'
                  }
              }
            }
          },
          ipConfigurationProfiles: {
            required: false,
            readOnly: true,
            serializedName: 'properties.ipConfigurationProfiles',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'IPConfigurationProfileElementType',
                  type: {
                    name: 'Composite',
                    className: 'IPConfigurationProfile'
                  }
              }
            }
          },
          resourceNavigationLinks: {
            required: false,
            serializedName: 'properties.resourceNavigationLinks',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'ResourceNavigationLinkElementType',
                  type: {
                    name: 'Composite',
                    className: 'ResourceNavigationLink'
                  }
              }
            }
          },
          serviceAssociationLinks: {
            required: false,
            serializedName: 'properties.serviceAssociationLinks',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'ServiceAssociationLinkElementType',
                  type: {
                    name: 'Composite',
                    className: 'ServiceAssociationLink'
                  }
              }
            }
          },
          delegations: {
            required: false,
            serializedName: 'properties.delegations',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'DelegationElementType',
                  type: {
                    name: 'Composite',
                    className: 'Delegation'
                  }
              }
            }
          },
          purpose: {
            required: false,
            readOnly: true,
            serializedName: 'properties.purpose',
            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 = Subnet;
