internal JobExecutionInformation(DateTimeOffset startTime, DateTimeOffset?endTime, string poolId, JobSchedulingError schedulingError, string terminateReason)
 {
     StartTime       = startTime;
     EndTime         = endTime;
     PoolId          = poolId;
     SchedulingError = schedulingError;
     TerminateReason = terminateReason;
 }
        internal static JobExecutionInformation DeserializeJobExecutionInformation(JsonElement element)
        {
            DateTimeOffset     startTime       = default;
            DateTimeOffset?    endTime         = default;
            string             poolId          = default;
            JobSchedulingError schedulingError = default;
            string             terminateReason = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("startTime"))
                {
                    startTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("endTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    endTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("poolId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    poolId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("schedulingError"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    schedulingError = JobSchedulingError.DeserializeJobSchedulingError(property.Value);
                    continue;
                }
                if (property.NameEquals("terminateReason"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    terminateReason = property.Value.GetString();
                    continue;
                }
            }
            return(new JobExecutionInformation(startTime, endTime, poolId, schedulingError, terminateReason));
        }