internal static SparkScheduler DeserializeSparkScheduler(JsonElement element)
        {
            DateTimeOffset?       submittedAt             = default;
            DateTimeOffset?       scheduledAt             = default;
            DateTimeOffset?       endedAt                 = default;
            DateTimeOffset?       cancellationRequestedAt = default;
            SchedulerCurrentState?currentState            = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("submittedAt"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    submittedAt = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("scheduledAt"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    scheduledAt = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("endedAt"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    endedAt = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("cancellationRequestedAt"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    cancellationRequestedAt = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("currentState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    currentState = new SchedulerCurrentState(property.Value.GetString());
                    continue;
                }
            }
            return(new SparkScheduler(submittedAt, scheduledAt, endedAt, cancellationRequestedAt, currentState));
        }
        internal static SparkScheduler DeserializeSparkScheduler(JsonElement element)
        {
            Optional <DateTimeOffset>        submittedAt             = default;
            Optional <DateTimeOffset>        scheduledAt             = default;
            Optional <DateTimeOffset>        endedAt                 = default;
            Optional <DateTimeOffset>        cancellationRequestedAt = default;
            Optional <SchedulerCurrentState> currentState            = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("submittedAt"))
                {
                    submittedAt = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("scheduledAt"))
                {
                    scheduledAt = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("endedAt"))
                {
                    endedAt = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("cancellationRequestedAt"))
                {
                    cancellationRequestedAt = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("currentState"))
                {
                    currentState = new SchedulerCurrentState(property.Value.GetString());
                    continue;
                }
            }
            return(new SparkScheduler(Optional.ToNullable(submittedAt), Optional.ToNullable(scheduledAt), Optional.ToNullable(endedAt), Optional.ToNullable(cancellationRequestedAt), Optional.ToNullable(currentState)));
        }