|   |  | 1 |  | // Copyright (c) Microsoft Corporation. All rights reserved. | 
|   |  | 2 |  | // Licensed under the MIT License. | 
|   |  | 3 |  |  | 
|   |  | 4 |  | // <auto-generated/> | 
|   |  | 5 |  |  | 
|   |  | 6 |  | #nullable disable | 
|   |  | 7 |  |  | 
|   |  | 8 |  | using System.Collections.Generic; | 
|   |  | 9 |  | using System.Text.Json; | 
|   |  | 10 |  | using Azure.Core; | 
|   |  | 11 |  |  | 
|   |  | 12 |  | namespace Azure.ResourceManager.Compute.Models | 
|   |  | 13 |  | { | 
|   |  | 14 |  |     public partial class DedicatedHostGroup : IUtf8JsonSerializable | 
|   |  | 15 |  |     { | 
|   |  | 16 |  |         void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) | 
|   |  | 17 |  |         { | 
|   | 4 | 18 |  |             writer.WriteStartObject(); | 
|   | 4 | 19 |  |             if (Zones != null) | 
|   |  | 20 |  |             { | 
|   | 4 | 21 |  |                 writer.WritePropertyName("zones"); | 
|   | 4 | 22 |  |                 writer.WriteStartArray(); | 
|   | 16 | 23 |  |                 foreach (var item in Zones) | 
|   |  | 24 |  |                 { | 
|   | 4 | 25 |  |                     writer.WriteStringValue(item); | 
|   |  | 26 |  |                 } | 
|   | 4 | 27 |  |                 writer.WriteEndArray(); | 
|   |  | 28 |  |             } | 
|   | 4 | 29 |  |             if (Id != null) | 
|   |  | 30 |  |             { | 
|   | 0 | 31 |  |                 writer.WritePropertyName("id"); | 
|   | 0 | 32 |  |                 writer.WriteStringValue(Id); | 
|   |  | 33 |  |             } | 
|   | 4 | 34 |  |             if (Name != null) | 
|   |  | 35 |  |             { | 
|   | 0 | 36 |  |                 writer.WritePropertyName("name"); | 
|   | 0 | 37 |  |                 writer.WriteStringValue(Name); | 
|   |  | 38 |  |             } | 
|   | 4 | 39 |  |             if (Type != null) | 
|   |  | 40 |  |             { | 
|   | 0 | 41 |  |                 writer.WritePropertyName("type"); | 
|   | 0 | 42 |  |                 writer.WriteStringValue(Type); | 
|   |  | 43 |  |             } | 
|   | 4 | 44 |  |             writer.WritePropertyName("location"); | 
|   | 4 | 45 |  |             writer.WriteStringValue(Location); | 
|   | 4 | 46 |  |             if (Tags != null) | 
|   |  | 47 |  |             { | 
|   | 0 | 48 |  |                 writer.WritePropertyName("tags"); | 
|   | 0 | 49 |  |                 writer.WriteStartObject(); | 
|   | 0 | 50 |  |                 foreach (var item in Tags) | 
|   |  | 51 |  |                 { | 
|   | 0 | 52 |  |                     writer.WritePropertyName(item.Key); | 
|   | 0 | 53 |  |                     writer.WriteStringValue(item.Value); | 
|   |  | 54 |  |                 } | 
|   | 0 | 55 |  |                 writer.WriteEndObject(); | 
|   |  | 56 |  |             } | 
|   | 4 | 57 |  |             writer.WritePropertyName("properties"); | 
|   | 4 | 58 |  |             writer.WriteStartObject(); | 
|   | 4 | 59 |  |             if (PlatformFaultDomainCount != null) | 
|   |  | 60 |  |             { | 
|   | 4 | 61 |  |                 writer.WritePropertyName("platformFaultDomainCount"); | 
|   | 4 | 62 |  |                 writer.WriteNumberValue(PlatformFaultDomainCount.Value); | 
|   |  | 63 |  |             } | 
|   | 4 | 64 |  |             if (Hosts != null) | 
|   |  | 65 |  |             { | 
|   | 0 | 66 |  |                 writer.WritePropertyName("hosts"); | 
|   | 0 | 67 |  |                 writer.WriteStartArray(); | 
|   | 0 | 68 |  |                 foreach (var item in Hosts) | 
|   |  | 69 |  |                 { | 
|   | 0 | 70 |  |                     writer.WriteObjectValue(item); | 
|   |  | 71 |  |                 } | 
|   | 0 | 72 |  |                 writer.WriteEndArray(); | 
|   |  | 73 |  |             } | 
|   | 4 | 74 |  |             writer.WriteEndObject(); | 
|   | 4 | 75 |  |             writer.WriteEndObject(); | 
|   | 4 | 76 |  |         } | 
|   |  | 77 |  |  | 
|   |  | 78 |  |         internal static DedicatedHostGroup DeserializeDedicatedHostGroup(JsonElement element) | 
|   |  | 79 |  |         { | 
|   | 24 | 80 |  |             IList<string> zones = default; | 
|   | 24 | 81 |  |             string id = default; | 
|   | 24 | 82 |  |             string name = default; | 
|   | 24 | 83 |  |             string type = default; | 
|   | 24 | 84 |  |             string location = default; | 
|   | 24 | 85 |  |             IDictionary<string, string> tags = default; | 
|   | 24 | 86 |  |             int? platformFaultDomainCount = default; | 
|   | 24 | 87 |  |             IList<SubResourceReadOnly> hosts = default; | 
|   | 320 | 88 |  |             foreach (var property in element.EnumerateObject()) | 
|   |  | 89 |  |             { | 
|   | 136 | 90 |  |                 if (property.NameEquals("zones")) | 
|   |  | 91 |  |                 { | 
|   | 24 | 92 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 93 |  |                     { | 
|   |  | 94 |  |                         continue; | 
|   |  | 95 |  |                     } | 
|   | 24 | 96 |  |                     List<string> array = new List<string>(); | 
|   | 96 | 97 |  |                     foreach (var item in property.Value.EnumerateArray()) | 
|   |  | 98 |  |                     { | 
|   | 24 | 99 |  |                         if (item.ValueKind == JsonValueKind.Null) | 
|   |  | 100 |  |                         { | 
|   | 0 | 101 |  |                             array.Add(null); | 
|   |  | 102 |  |                         } | 
|   |  | 103 |  |                         else | 
|   |  | 104 |  |                         { | 
|   | 24 | 105 |  |                             array.Add(item.GetString()); | 
|   |  | 106 |  |                         } | 
|   |  | 107 |  |                     } | 
|   | 24 | 108 |  |                     zones = array; | 
|   | 24 | 109 |  |                     continue; | 
|   |  | 110 |  |                 } | 
|   | 112 | 111 |  |                 if (property.NameEquals("id")) | 
|   |  | 112 |  |                 { | 
|   | 24 | 113 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 114 |  |                     { | 
|   |  | 115 |  |                         continue; | 
|   |  | 116 |  |                     } | 
|   | 24 | 117 |  |                     id = property.Value.GetString(); | 
|   | 24 | 118 |  |                     continue; | 
|   |  | 119 |  |                 } | 
|   | 88 | 120 |  |                 if (property.NameEquals("name")) | 
|   |  | 121 |  |                 { | 
|   | 24 | 122 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 123 |  |                     { | 
|   |  | 124 |  |                         continue; | 
|   |  | 125 |  |                     } | 
|   | 24 | 126 |  |                     name = property.Value.GetString(); | 
|   | 24 | 127 |  |                     continue; | 
|   |  | 128 |  |                 } | 
|   | 64 | 129 |  |                 if (property.NameEquals("type")) | 
|   |  | 130 |  |                 { | 
|   | 0 | 131 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 132 |  |                     { | 
|   |  | 133 |  |                         continue; | 
|   |  | 134 |  |                     } | 
|   | 0 | 135 |  |                     type = property.Value.GetString(); | 
|   | 0 | 136 |  |                     continue; | 
|   |  | 137 |  |                 } | 
|   | 64 | 138 |  |                 if (property.NameEquals("location")) | 
|   |  | 139 |  |                 { | 
|   | 24 | 140 |  |                     location = property.Value.GetString(); | 
|   | 24 | 141 |  |                     continue; | 
|   |  | 142 |  |                 } | 
|   | 40 | 143 |  |                 if (property.NameEquals("tags")) | 
|   |  | 144 |  |                 { | 
|   | 16 | 145 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 146 |  |                     { | 
|   |  | 147 |  |                         continue; | 
|   |  | 148 |  |                     } | 
|   | 16 | 149 |  |                     Dictionary<string, string> dictionary = new Dictionary<string, string>(); | 
|   | 64 | 150 |  |                     foreach (var property0 in property.Value.EnumerateObject()) | 
|   |  | 151 |  |                     { | 
|   | 16 | 152 |  |                         if (property0.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 153 |  |                         { | 
|   | 0 | 154 |  |                             dictionary.Add(property0.Name, null); | 
|   |  | 155 |  |                         } | 
|   |  | 156 |  |                         else | 
|   |  | 157 |  |                         { | 
|   | 16 | 158 |  |                             dictionary.Add(property0.Name, property0.Value.GetString()); | 
|   |  | 159 |  |                         } | 
|   |  | 160 |  |                     } | 
|   | 16 | 161 |  |                     tags = dictionary; | 
|   | 16 | 162 |  |                     continue; | 
|   |  | 163 |  |                 } | 
|   | 24 | 164 |  |                 if (property.NameEquals("properties")) | 
|   |  | 165 |  |                 { | 
|   | 96 | 166 |  |                     foreach (var property0 in property.Value.EnumerateObject()) | 
|   |  | 167 |  |                     { | 
|   | 24 | 168 |  |                         if (property0.NameEquals("platformFaultDomainCount")) | 
|   |  | 169 |  |                         { | 
|   | 24 | 170 |  |                             if (property0.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 171 |  |                             { | 
|   |  | 172 |  |                                 continue; | 
|   |  | 173 |  |                             } | 
|   | 24 | 174 |  |                             platformFaultDomainCount = property0.Value.GetInt32(); | 
|   | 24 | 175 |  |                             continue; | 
|   |  | 176 |  |                         } | 
|   | 0 | 177 |  |                         if (property0.NameEquals("hosts")) | 
|   |  | 178 |  |                         { | 
|   | 0 | 179 |  |                             if (property0.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 180 |  |                             { | 
|   |  | 181 |  |                                 continue; | 
|   |  | 182 |  |                             } | 
|   | 0 | 183 |  |                             List<SubResourceReadOnly> array = new List<SubResourceReadOnly>(); | 
|   | 0 | 184 |  |                             foreach (var item in property0.Value.EnumerateArray()) | 
|   |  | 185 |  |                             { | 
|   | 0 | 186 |  |                                 if (item.ValueKind == JsonValueKind.Null) | 
|   |  | 187 |  |                                 { | 
|   | 0 | 188 |  |                                     array.Add(null); | 
|   |  | 189 |  |                                 } | 
|   |  | 190 |  |                                 else | 
|   |  | 191 |  |                                 { | 
|   | 0 | 192 |  |                                     array.Add(SubResourceReadOnly.DeserializeSubResourceReadOnly(item)); | 
|   |  | 193 |  |                                 } | 
|   |  | 194 |  |                             } | 
|   | 0 | 195 |  |                             hosts = array; | 
|   |  | 196 |  |                             continue; | 
|   |  | 197 |  |                         } | 
|   |  | 198 |  |                     } | 
|   |  | 199 |  |                     continue; | 
|   |  | 200 |  |                 } | 
|   |  | 201 |  |             } | 
|   | 24 | 202 |  |             return new DedicatedHostGroup(id, name, type, location, tags, zones, platformFaultDomainCount, hosts); | 
|   |  | 203 |  |         } | 
|   |  | 204 |  |     } | 
|   |  | 205 |  | } |