void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
        {
            writer.WriteStartObject();
            writer.WritePropertyName("operator");
            writer.WriteStringValue(Operator.ToString());
            writer.WritePropertyName("alertSensitivity");
            writer.WriteStringValue(AlertSensitivity.ToString());
            writer.WritePropertyName("failingPeriods");
            writer.WriteObjectValue(FailingPeriods);
            if (Optional.IsDefined(IgnoreDataBefore))
            {
                writer.WritePropertyName("ignoreDataBefore");
                writer.WriteStringValue(IgnoreDataBefore.Value, "O");
            }
            writer.WritePropertyName("criterionType");
            writer.WriteStringValue(CriterionType.ToString());
            writer.WritePropertyName("name");
            writer.WriteStringValue(Name);
            writer.WritePropertyName("metricName");
            writer.WriteStringValue(MetricName);
            if (Optional.IsDefined(MetricNamespace))
            {
                writer.WritePropertyName("metricNamespace");
                writer.WriteStringValue(MetricNamespace);
            }
            writer.WritePropertyName("timeAggregation");
            writer.WriteStringValue(TimeAggregation.ToString());
            if (Optional.IsCollectionDefined(Dimensions))
            {
                writer.WritePropertyName("dimensions");
                writer.WriteStartArray();
                foreach (var item in Dimensions)
                {
                    writer.WriteObjectValue(item);
                }
                writer.WriteEndArray();
            }
            if (Optional.IsDefined(SkipMetricValidation))
            {
                writer.WritePropertyName("skipMetricValidation");
                writer.WriteBooleanValue(SkipMetricValidation.Value);
            }
            foreach (var item in AdditionalProperties)
            {
                writer.WritePropertyName(item.Key);
#if NET6_0_OR_GREATER
                writer.WriteRawValue(item.Value);
#else
                JsonSerializer.Serialize(writer, JsonDocument.Parse(item.Value.ToString()).RootElement);
#endif
            }
            writer.WriteEndObject();
        }
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("operator");
     writer.WriteStringValue(Operator.ToString());
     writer.WritePropertyName("alertSensitivity");
     writer.WriteStringValue(AlertSensitivity.ToString());
     writer.WritePropertyName("failingPeriods");
     writer.WriteObjectValue(FailingPeriods);
     if (Optional.IsDefined(IgnoreDataBefore))
     {
         writer.WritePropertyName("ignoreDataBefore");
         writer.WriteStringValue(IgnoreDataBefore.Value, "O");
     }
     writer.WritePropertyName("criterionType");
     writer.WriteStringValue(CriterionType.ToString());
     writer.WritePropertyName("name");
     writer.WriteStringValue(Name);
     writer.WritePropertyName("metricName");
     writer.WriteStringValue(MetricName);
     if (Optional.IsDefined(MetricNamespace))
     {
         writer.WritePropertyName("metricNamespace");
         writer.WriteStringValue(MetricNamespace);
     }
     writer.WritePropertyName("timeAggregation");
     writer.WriteStringValue(TimeAggregation.ToSerialString());
     if (Optional.IsCollectionDefined(Dimensions))
     {
         writer.WritePropertyName("dimensions");
         writer.WriteStartArray();
         foreach (var item in Dimensions)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     foreach (var item in AdditionalProperties)
     {
         writer.WritePropertyName(item.Key);
         writer.WriteObjectValue(item.Value);
     }
     writer.WriteEndObject();
 }