internal static EventData DeserializeEventData(JsonElement element)
        {
            Optional <SenderAuthorization> authorization            = default;
            Optional <IReadOnlyDictionary <string, string> > claims = default;
            Optional <string>            caller                         = default;
            Optional <string>            description                    = default;
            Optional <string>            id                             = default;
            Optional <string>            eventDataId                    = default;
            Optional <string>            correlationId                  = default;
            Optional <LocalizableString> eventName                      = default;
            Optional <LocalizableString> category                       = default;
            Optional <HttpRequestInfo>   httpRequest                    = default;
            Optional <EventLevel>        level                          = default;
            Optional <string>            resourceGroupName              = default;
            Optional <LocalizableString> resourceProviderName           = default;
            Optional <string>            resourceId                     = default;
            Optional <LocalizableString> resourceType                   = default;
            Optional <string>            operationId                    = default;
            Optional <LocalizableString> operationName                  = default;
            Optional <IReadOnlyDictionary <string, string> > properties = default;
            Optional <LocalizableString> status                         = default;
            Optional <LocalizableString> subStatus                      = default;
            Optional <DateTimeOffset>    eventTimestamp                 = default;
            Optional <DateTimeOffset>    submissionTimestamp            = default;
            Optional <string>            subscriptionId                 = default;
            Optional <string>            tenantId                       = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("authorization"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    authorization = SenderAuthorization.DeserializeSenderAuthorization(property.Value);
                    continue;
                }
                if (property.NameEquals("claims"))
                {
                    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());
                    }
                    claims = dictionary;
                    continue;
                }
                if (property.NameEquals("caller"))
                {
                    caller = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("eventDataId"))
                {
                    eventDataId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("correlationId"))
                {
                    correlationId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("eventName"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    eventName = LocalizableString.DeserializeLocalizableString(property.Value);
                    continue;
                }
                if (property.NameEquals("category"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    category = LocalizableString.DeserializeLocalizableString(property.Value);
                    continue;
                }
                if (property.NameEquals("httpRequest"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    httpRequest = HttpRequestInfo.DeserializeHttpRequestInfo(property.Value);
                    continue;
                }
                if (property.NameEquals("level"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    level = property.Value.GetString().ToEventLevel();
                    continue;
                }
                if (property.NameEquals("resourceGroupName"))
                {
                    resourceGroupName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("resourceProviderName"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    resourceProviderName = LocalizableString.DeserializeLocalizableString(property.Value);
                    continue;
                }
                if (property.NameEquals("resourceId"))
                {
                    resourceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("resourceType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    resourceType = LocalizableString.DeserializeLocalizableString(property.Value);
                    continue;
                }
                if (property.NameEquals("operationId"))
                {
                    operationId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("operationName"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    operationName = LocalizableString.DeserializeLocalizableString(property.Value);
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    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());
                    }
                    properties = dictionary;
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    status = LocalizableString.DeserializeLocalizableString(property.Value);
                    continue;
                }
                if (property.NameEquals("subStatus"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    subStatus = LocalizableString.DeserializeLocalizableString(property.Value);
                    continue;
                }
                if (property.NameEquals("eventTimestamp"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    eventTimestamp = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("submissionTimestamp"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    submissionTimestamp = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("subscriptionId"))
                {
                    subscriptionId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tenantId"))
                {
                    tenantId = property.Value.GetString();
                    continue;
                }
            }
            return(new EventData(authorization.Value, Optional.ToDictionary(claims), caller.Value, description.Value, id.Value, eventDataId.Value, correlationId.Value, eventName.Value, category.Value, httpRequest.Value, Optional.ToNullable(level), resourceGroupName.Value, resourceProviderName.Value, resourceId.Value, resourceType.Value, operationId.Value, operationName.Value, Optional.ToDictionary(properties), status.Value, subStatus.Value, Optional.ToNullable(eventTimestamp), Optional.ToNullable(submissionTimestamp), subscriptionId.Value, tenantId.Value));
        }
        internal static BaselineResponse DeserializeBaselineResponse(JsonElement element)
        {
            Optional <string>            id          = default;
            Optional <string>            type        = default;
            Optional <LocalizableString> name        = default;
            Optional <string>            timespan    = default;
            Optional <TimeSpan>          interval    = default;
            Optional <string>            aggregation = default;
            Optional <IReadOnlyList <DateTimeOffset> >        timestamps = default;
            Optional <IReadOnlyList <Baseline> >              baseline   = default;
            Optional <IReadOnlyList <BaselineMetadataValue> > metadata   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = LocalizableString.DeserializeLocalizableString(property.Value);
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("timespan"))
                        {
                            timespan = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("interval"))
                        {
                            interval = property0.Value.GetTimeSpan("P");
                            continue;
                        }
                        if (property0.NameEquals("aggregation"))
                        {
                            aggregation = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("timestamps"))
                        {
                            List <DateTimeOffset> array = new List <DateTimeOffset>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetDateTimeOffset("O"));
                            }
                            timestamps = array;
                            continue;
                        }
                        if (property0.NameEquals("baseline"))
                        {
                            List <Baseline> array = new List <Baseline>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(Models.Baseline.DeserializeBaseline(item));
                            }
                            baseline = array;
                            continue;
                        }
                        if (property0.NameEquals("metadata"))
                        {
                            List <BaselineMetadataValue> array = new List <BaselineMetadataValue>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(BaselineMetadataValue.DeserializeBaselineMetadataValue(item));
                            }
                            metadata = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new BaselineResponse(id.Value, type.Value, name.Value, timespan.Value, Optional.ToNullable(interval), aggregation.Value, Optional.ToList(timestamps), Optional.ToList(baseline), Optional.ToList(metadata)));
        }