internal PrivateLinkService(string id, string name, string type, string location, IDictionary <string, string> tags, string etag, IList <FrontendIPConfiguration> loadBalancerFrontendIpConfigurations, IList <PrivateLinkServiceIpConfiguration> ipConfigurations, IReadOnlyList <NetworkInterface> networkInterfaces, ProvisioningState?provisioningState, IReadOnlyList <PrivateEndpointConnection> privateEndpointConnections, PrivateLinkServicePropertiesVisibility visibility, PrivateLinkServicePropertiesAutoApproval autoApproval, IList <string> fqdns, string @alias, bool?enableProxyProtocol) : base(id, name, type, location, tags)
 {
     Etag = etag;
     LoadBalancerFrontendIpConfigurations = loadBalancerFrontendIpConfigurations;
     IpConfigurations           = ipConfigurations;
     NetworkInterfaces          = networkInterfaces;
     ProvisioningState          = provisioningState;
     PrivateEndpointConnections = privateEndpointConnections;
     Visibility          = visibility;
     AutoApproval        = autoApproval;
     Fqdns               = fqdns;
     Alias               = @alias;
     EnableProxyProtocol = enableProxyProtocol;
 }
        internal static PrivateLinkService DeserializePrivateLinkService(JsonElement element)
        {
            Optional <string> etag     = default;
            Optional <string> id       = default;
            Optional <string> name     = default;
            Optional <string> type     = default;
            Optional <string> location = default;
            Optional <IDictionary <string, string> >              tags = default;
            Optional <IList <FrontendIPConfiguration> >           loadBalancerFrontendIpConfigurations = default;
            Optional <IList <PrivateLinkServiceIpConfiguration> > ipConfigurations  = default;
            Optional <IReadOnlyList <NetworkInterface> >          networkInterfaces = default;
            Optional <ProvisioningState> provisioningState = default;
            Optional <IReadOnlyList <PrivateEndpointConnection> > privateEndpointConnections = default;
            Optional <PrivateLinkServicePropertiesVisibility>     visibility   = default;
            Optional <PrivateLinkServicePropertiesAutoApproval>   autoApproval = default;
            Optional <IList <string> > fqdns  = default;
            Optional <string>          @alias = default;
            Optional <bool>            enableProxyProtocol = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("loadBalancerFrontendIpConfigurations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <FrontendIPConfiguration> array = new List <FrontendIPConfiguration>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(FrontendIPConfiguration.DeserializeFrontendIPConfiguration(item));
                            }
                            loadBalancerFrontendIpConfigurations = array;
                            continue;
                        }
                        if (property0.NameEquals("ipConfigurations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <PrivateLinkServiceIpConfiguration> array = new List <PrivateLinkServiceIpConfiguration>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(PrivateLinkServiceIpConfiguration.DeserializePrivateLinkServiceIpConfiguration(item));
                            }
                            ipConfigurations = array;
                            continue;
                        }
                        if (property0.NameEquals("networkInterfaces"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <NetworkInterface> array = new List <NetworkInterface>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(NetworkInterface.DeserializeNetworkInterface(item));
                            }
                            networkInterfaces = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("privateEndpointConnections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <PrivateEndpointConnection> array = new List <PrivateEndpointConnection>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(PrivateEndpointConnection.DeserializePrivateEndpointConnection(item));
                            }
                            privateEndpointConnections = array;
                            continue;
                        }
                        if (property0.NameEquals("visibility"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            visibility = PrivateLinkServicePropertiesVisibility.DeserializePrivateLinkServicePropertiesVisibility(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("autoApproval"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            autoApproval = PrivateLinkServicePropertiesAutoApproval.DeserializePrivateLinkServicePropertiesAutoApproval(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("fqdns"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetString());
                            }
                            fqdns = array;
                            continue;
                        }
                        if (property0.NameEquals("alias"))
                        {
                            @alias = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("enableProxyProtocol"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableProxyProtocol = property0.Value.GetBoolean();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new PrivateLinkService(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(loadBalancerFrontendIpConfigurations), Optional.ToList(ipConfigurations), Optional.ToList(networkInterfaces), Optional.ToNullable(provisioningState), Optional.ToList(privateEndpointConnections), visibility.Value, autoApproval.Value, Optional.ToList(fqdns), @alias.Value, Optional.ToNullable(enableProxyProtocol)));
        }