|   |  | 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.Network.Models | 
|   |  | 13 |  | { | 
|   |  | 14 |  |     public partial class MetricSpecification | 
|   |  | 15 |  |     { | 
|   |  | 16 |  |         internal static MetricSpecification DeserializeMetricSpecification(JsonElement element) | 
|   |  | 17 |  |         { | 
|   | 0 | 18 |  |             string name = default; | 
|   | 0 | 19 |  |             string displayName = default; | 
|   | 0 | 20 |  |             string displayDescription = default; | 
|   | 0 | 21 |  |             string unit = default; | 
|   | 0 | 22 |  |             string aggregationType = default; | 
|   | 0 | 23 |  |             IReadOnlyList<Availability> availabilities = default; | 
|   | 0 | 24 |  |             bool? enableRegionalMdmAccount = default; | 
|   | 0 | 25 |  |             bool? fillGapWithZero = default; | 
|   | 0 | 26 |  |             string metricFilterPattern = default; | 
|   | 0 | 27 |  |             IReadOnlyList<Dimension> dimensions = default; | 
|   | 0 | 28 |  |             bool? isInternal = default; | 
|   | 0 | 29 |  |             string sourceMdmAccount = default; | 
|   | 0 | 30 |  |             string sourceMdmNamespace = default; | 
|   | 0 | 31 |  |             string resourceIdDimensionNameOverride = default; | 
|   | 0 | 32 |  |             foreach (var property in element.EnumerateObject()) | 
|   |  | 33 |  |             { | 
|   | 0 | 34 |  |                 if (property.NameEquals("name")) | 
|   |  | 35 |  |                 { | 
|   | 0 | 36 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 37 |  |                     { | 
|   |  | 38 |  |                         continue; | 
|   |  | 39 |  |                     } | 
|   | 0 | 40 |  |                     name = property.Value.GetString(); | 
|   | 0 | 41 |  |                     continue; | 
|   |  | 42 |  |                 } | 
|   | 0 | 43 |  |                 if (property.NameEquals("displayName")) | 
|   |  | 44 |  |                 { | 
|   | 0 | 45 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 46 |  |                     { | 
|   |  | 47 |  |                         continue; | 
|   |  | 48 |  |                     } | 
|   | 0 | 49 |  |                     displayName = property.Value.GetString(); | 
|   | 0 | 50 |  |                     continue; | 
|   |  | 51 |  |                 } | 
|   | 0 | 52 |  |                 if (property.NameEquals("displayDescription")) | 
|   |  | 53 |  |                 { | 
|   | 0 | 54 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 55 |  |                     { | 
|   |  | 56 |  |                         continue; | 
|   |  | 57 |  |                     } | 
|   | 0 | 58 |  |                     displayDescription = property.Value.GetString(); | 
|   | 0 | 59 |  |                     continue; | 
|   |  | 60 |  |                 } | 
|   | 0 | 61 |  |                 if (property.NameEquals("unit")) | 
|   |  | 62 |  |                 { | 
|   | 0 | 63 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 64 |  |                     { | 
|   |  | 65 |  |                         continue; | 
|   |  | 66 |  |                     } | 
|   | 0 | 67 |  |                     unit = property.Value.GetString(); | 
|   | 0 | 68 |  |                     continue; | 
|   |  | 69 |  |                 } | 
|   | 0 | 70 |  |                 if (property.NameEquals("aggregationType")) | 
|   |  | 71 |  |                 { | 
|   | 0 | 72 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 73 |  |                     { | 
|   |  | 74 |  |                         continue; | 
|   |  | 75 |  |                     } | 
|   | 0 | 76 |  |                     aggregationType = property.Value.GetString(); | 
|   | 0 | 77 |  |                     continue; | 
|   |  | 78 |  |                 } | 
|   | 0 | 79 |  |                 if (property.NameEquals("availabilities")) | 
|   |  | 80 |  |                 { | 
|   | 0 | 81 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 82 |  |                     { | 
|   |  | 83 |  |                         continue; | 
|   |  | 84 |  |                     } | 
|   | 0 | 85 |  |                     List<Availability> array = new List<Availability>(); | 
|   | 0 | 86 |  |                     foreach (var item in property.Value.EnumerateArray()) | 
|   |  | 87 |  |                     { | 
|   | 0 | 88 |  |                         if (item.ValueKind == JsonValueKind.Null) | 
|   |  | 89 |  |                         { | 
|   | 0 | 90 |  |                             array.Add(null); | 
|   |  | 91 |  |                         } | 
|   |  | 92 |  |                         else | 
|   |  | 93 |  |                         { | 
|   | 0 | 94 |  |                             array.Add(Availability.DeserializeAvailability(item)); | 
|   |  | 95 |  |                         } | 
|   |  | 96 |  |                     } | 
|   | 0 | 97 |  |                     availabilities = array; | 
|   | 0 | 98 |  |                     continue; | 
|   |  | 99 |  |                 } | 
|   | 0 | 100 |  |                 if (property.NameEquals("enableRegionalMdmAccount")) | 
|   |  | 101 |  |                 { | 
|   | 0 | 102 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 103 |  |                     { | 
|   |  | 104 |  |                         continue; | 
|   |  | 105 |  |                     } | 
|   | 0 | 106 |  |                     enableRegionalMdmAccount = property.Value.GetBoolean(); | 
|   | 0 | 107 |  |                     continue; | 
|   |  | 108 |  |                 } | 
|   | 0 | 109 |  |                 if (property.NameEquals("fillGapWithZero")) | 
|   |  | 110 |  |                 { | 
|   | 0 | 111 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 112 |  |                     { | 
|   |  | 113 |  |                         continue; | 
|   |  | 114 |  |                     } | 
|   | 0 | 115 |  |                     fillGapWithZero = property.Value.GetBoolean(); | 
|   | 0 | 116 |  |                     continue; | 
|   |  | 117 |  |                 } | 
|   | 0 | 118 |  |                 if (property.NameEquals("metricFilterPattern")) | 
|   |  | 119 |  |                 { | 
|   | 0 | 120 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 121 |  |                     { | 
|   |  | 122 |  |                         continue; | 
|   |  | 123 |  |                     } | 
|   | 0 | 124 |  |                     metricFilterPattern = property.Value.GetString(); | 
|   | 0 | 125 |  |                     continue; | 
|   |  | 126 |  |                 } | 
|   | 0 | 127 |  |                 if (property.NameEquals("dimensions")) | 
|   |  | 128 |  |                 { | 
|   | 0 | 129 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 130 |  |                     { | 
|   |  | 131 |  |                         continue; | 
|   |  | 132 |  |                     } | 
|   | 0 | 133 |  |                     List<Dimension> array = new List<Dimension>(); | 
|   | 0 | 134 |  |                     foreach (var item in property.Value.EnumerateArray()) | 
|   |  | 135 |  |                     { | 
|   | 0 | 136 |  |                         if (item.ValueKind == JsonValueKind.Null) | 
|   |  | 137 |  |                         { | 
|   | 0 | 138 |  |                             array.Add(null); | 
|   |  | 139 |  |                         } | 
|   |  | 140 |  |                         else | 
|   |  | 141 |  |                         { | 
|   | 0 | 142 |  |                             array.Add(Dimension.DeserializeDimension(item)); | 
|   |  | 143 |  |                         } | 
|   |  | 144 |  |                     } | 
|   | 0 | 145 |  |                     dimensions = array; | 
|   | 0 | 146 |  |                     continue; | 
|   |  | 147 |  |                 } | 
|   | 0 | 148 |  |                 if (property.NameEquals("isInternal")) | 
|   |  | 149 |  |                 { | 
|   | 0 | 150 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 151 |  |                     { | 
|   |  | 152 |  |                         continue; | 
|   |  | 153 |  |                     } | 
|   | 0 | 154 |  |                     isInternal = property.Value.GetBoolean(); | 
|   | 0 | 155 |  |                     continue; | 
|   |  | 156 |  |                 } | 
|   | 0 | 157 |  |                 if (property.NameEquals("sourceMdmAccount")) | 
|   |  | 158 |  |                 { | 
|   | 0 | 159 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 160 |  |                     { | 
|   |  | 161 |  |                         continue; | 
|   |  | 162 |  |                     } | 
|   | 0 | 163 |  |                     sourceMdmAccount = property.Value.GetString(); | 
|   | 0 | 164 |  |                     continue; | 
|   |  | 165 |  |                 } | 
|   | 0 | 166 |  |                 if (property.NameEquals("sourceMdmNamespace")) | 
|   |  | 167 |  |                 { | 
|   | 0 | 168 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 169 |  |                     { | 
|   |  | 170 |  |                         continue; | 
|   |  | 171 |  |                     } | 
|   | 0 | 172 |  |                     sourceMdmNamespace = property.Value.GetString(); | 
|   | 0 | 173 |  |                     continue; | 
|   |  | 174 |  |                 } | 
|   | 0 | 175 |  |                 if (property.NameEquals("resourceIdDimensionNameOverride")) | 
|   |  | 176 |  |                 { | 
|   | 0 | 177 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|   |  | 178 |  |                     { | 
|   |  | 179 |  |                         continue; | 
|   |  | 180 |  |                     } | 
|   | 0 | 181 |  |                     resourceIdDimensionNameOverride = property.Value.GetString(); | 
|   |  | 182 |  |                     continue; | 
|   |  | 183 |  |                 } | 
|   |  | 184 |  |             } | 
|   | 0 | 185 |  |             return new MetricSpecification(name, displayName, displayDescription, unit, aggregationType, availabilities, | 
|   |  | 186 |  |         } | 
|   |  | 187 |  |     } | 
|   |  | 188 |  | } |