internal ComputeNode(string id, string url, ComputeNodeState?state, SchedulingState?schedulingState, DateTimeOffset?stateTransitionTime, DateTimeOffset?lastBootTime, DateTimeOffset?allocationTime, string ipAddress, string affinityId, string vmSize, int?totalTasksRun, int?runningTasksCount, int?totalTasksSucceeded, IReadOnlyList <TaskInformation> recentTasks, StartTask startTask, StartTaskInformation startTaskInfo, IReadOnlyList <CertificateReference> certificateReferences, IReadOnlyList <ComputeNodeError> errors, bool?isDedicated, ComputeNodeEndpointConfiguration endpointConfiguration, NodeAgentInformation nodeAgentInfo)
 {
     Id                    = id;
     Url                   = url;
     State                 = state;
     SchedulingState       = schedulingState;
     StateTransitionTime   = stateTransitionTime;
     LastBootTime          = lastBootTime;
     AllocationTime        = allocationTime;
     IpAddress             = ipAddress;
     AffinityId            = affinityId;
     VmSize                = vmSize;
     TotalTasksRun         = totalTasksRun;
     RunningTasksCount     = runningTasksCount;
     TotalTasksSucceeded   = totalTasksSucceeded;
     RecentTasks           = recentTasks;
     StartTask             = startTask;
     StartTaskInfo         = startTaskInfo;
     CertificateReferences = certificateReferences;
     Errors                = errors;
     IsDedicated           = isDedicated;
     EndpointConfiguration = endpointConfiguration;
     NodeAgentInfo         = nodeAgentInfo;
 }
        internal static ComputeNode DeserializeComputeNode(JsonElement element)
        {
            string           id                  = default;
            string           url                 = default;
            ComputeNodeState?state               = default;
            SchedulingState? schedulingState     = default;
            DateTimeOffset?  stateTransitionTime = default;
            DateTimeOffset?  lastBootTime        = default;
            DateTimeOffset?  allocationTime      = default;
            string           ipAddress           = default;
            string           affinityId          = default;
            string           vmSize              = default;
            int?totalTasksRun       = default;
            int?runningTasksCount   = default;
            int?totalTasksSucceeded = default;
            IReadOnlyList <TaskInformation> recentTasks = default;
            StartTask            startTask     = default;
            StartTaskInformation startTaskInfo = default;
            IReadOnlyList <CertificateReference> certificateReferences = default;
            IReadOnlyList <ComputeNodeError>     errors = default;
            bool?isDedicated = default;
            ComputeNodeEndpointConfiguration endpointConfiguration = default;
            NodeAgentInformation             nodeAgentInfo         = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("url"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    url = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("state"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    state = property.Value.GetString().ToComputeNodeState();
                    continue;
                }
                if (property.NameEquals("schedulingState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    schedulingState = property.Value.GetString().ToSchedulingState();
                    continue;
                }
                if (property.NameEquals("stateTransitionTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    stateTransitionTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("lastBootTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    lastBootTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("allocationTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    allocationTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("ipAddress"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    ipAddress = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("affinityId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    affinityId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("vmSize"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    vmSize = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("totalTasksRun"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    totalTasksRun = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("runningTasksCount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    runningTasksCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("totalTasksSucceeded"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    totalTasksSucceeded = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("recentTasks"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <TaskInformation> array = new List <TaskInformation>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(TaskInformation.DeserializeTaskInformation(item));
                    }
                    recentTasks = array;
                    continue;
                }
                if (property.NameEquals("startTask"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    startTask = StartTask.DeserializeStartTask(property.Value);
                    continue;
                }
                if (property.NameEquals("startTaskInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    startTaskInfo = StartTaskInformation.DeserializeStartTaskInformation(property.Value);
                    continue;
                }
                if (property.NameEquals("certificateReferences"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <CertificateReference> array = new List <CertificateReference>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(CertificateReference.DeserializeCertificateReference(item));
                    }
                    certificateReferences = array;
                    continue;
                }
                if (property.NameEquals("errors"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <ComputeNodeError> array = new List <ComputeNodeError>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ComputeNodeError.DeserializeComputeNodeError(item));
                    }
                    errors = array;
                    continue;
                }
                if (property.NameEquals("isDedicated"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    isDedicated = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("endpointConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    endpointConfiguration = ComputeNodeEndpointConfiguration.DeserializeComputeNodeEndpointConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("nodeAgentInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    nodeAgentInfo = NodeAgentInformation.DeserializeNodeAgentInformation(property.Value);
                    continue;
                }
            }
            return(new ComputeNode(id, url, state, schedulingState, stateTransitionTime, lastBootTime, allocationTime, ipAddress, affinityId, vmSize, totalTasksRun, runningTasksCount, totalTasksSucceeded, recentTasks, startTask, startTaskInfo, certificateReferences, errors, isDedicated, endpointConfiguration, nodeAgentInfo));
        }