internal static RestorePointSourceMetadata DeserializeRestorePointSourceMetadata(JsonElement element)
        {
            Optional <HardwareProfile> hardwareProfile = default;
            Optional <RestorePointSourceVmStorageProfile> storageProfile = default;
            Optional <OSProfile>          osProfile          = default;
            Optional <DiagnosticsProfile> diagnosticsProfile = default;
            Optional <string>             licenseType        = default;
            Optional <string>             vmId            = default;
            Optional <SecurityProfile>    securityProfile = default;
            Optional <string>             location        = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("hardwareProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    hardwareProfile = HardwareProfile.DeserializeHardwareProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("storageProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    storageProfile = RestorePointSourceVmStorageProfile.DeserializeRestorePointSourceVmStorageProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("osProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    osProfile = OSProfile.DeserializeOSProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("diagnosticsProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    diagnosticsProfile = DiagnosticsProfile.DeserializeDiagnosticsProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("licenseType"))
                {
                    licenseType = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("vmId"))
                {
                    vmId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("securityProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    securityProfile = SecurityProfile.DeserializeSecurityProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
            }
            return(new RestorePointSourceMetadata(hardwareProfile.Value, storageProfile.Value, osProfile.Value, diagnosticsProfile.Value, licenseType.Value, vmId.Value, securityProfile.Value, location.Value));
        }
        internal static VirtualMachineScaleSetVmProfile DeserializeVirtualMachineScaleSetVmProfile(JsonElement element)
        {
            Optional <VirtualMachineScaleSetOSProfile>      osProfile      = default;
            Optional <VirtualMachineScaleSetStorageProfile> storageProfile = default;
            Optional <VirtualMachineScaleSetNetworkProfile> networkProfile = default;
            Optional <SecurityProfile>    securityProfile    = default;
            Optional <DiagnosticsProfile> diagnosticsProfile = default;
            Optional <VirtualMachineScaleSetExtensionProfile> extensionProfile = default;
            Optional <string> licenseType = default;
            Optional <VirtualMachinePriorityTypes>       priority       = default;
            Optional <VirtualMachineEvictionPolicyTypes> evictionPolicy = default;
            Optional <BillingProfile>         billingProfile            = default;
            Optional <ScheduledEventsProfile> scheduledEventsProfile    = default;
            Optional <string> userData = default;
            Optional <CapacityReservationProfile> capacityReservation = default;
            Optional <ApplicationProfile>         applicationProfile  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("osProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    osProfile = VirtualMachineScaleSetOSProfile.DeserializeVirtualMachineScaleSetOSProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("storageProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    storageProfile = VirtualMachineScaleSetStorageProfile.DeserializeVirtualMachineScaleSetStorageProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("networkProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    networkProfile = VirtualMachineScaleSetNetworkProfile.DeserializeVirtualMachineScaleSetNetworkProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("securityProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    securityProfile = SecurityProfile.DeserializeSecurityProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("diagnosticsProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    diagnosticsProfile = DiagnosticsProfile.DeserializeDiagnosticsProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("extensionProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    extensionProfile = VirtualMachineScaleSetExtensionProfile.DeserializeVirtualMachineScaleSetExtensionProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("licenseType"))
                {
                    licenseType = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("priority"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    priority = new VirtualMachinePriorityTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("evictionPolicy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    evictionPolicy = new VirtualMachineEvictionPolicyTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("billingProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    billingProfile = BillingProfile.DeserializeBillingProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("scheduledEventsProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    scheduledEventsProfile = ScheduledEventsProfile.DeserializeScheduledEventsProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("userData"))
                {
                    userData = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("capacityReservation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    capacityReservation = CapacityReservationProfile.DeserializeCapacityReservationProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("applicationProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    applicationProfile = ApplicationProfile.DeserializeApplicationProfile(property.Value);
                    continue;
                }
            }
            return(new VirtualMachineScaleSetVmProfile(osProfile.Value, storageProfile.Value, networkProfile.Value, securityProfile.Value, diagnosticsProfile.Value, extensionProfile.Value, licenseType.Value, Optional.ToNullable(priority), Optional.ToNullable(evictionPolicy), billingProfile.Value, scheduledEventsProfile.Value, userData.Value, capacityReservation.Value, applicationProfile.Value));
        }