| | 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.Analytics.Synapse.Artifacts.Models |
| | 13 | | { |
| | 14 | | public partial class SwitchCase : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Optional.IsDefined(Value)) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("value"); |
| 0 | 22 | | writer.WriteStringValue(Value); |
| | 23 | | } |
| 0 | 24 | | if (Optional.IsCollectionDefined(Activities)) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("activities"); |
| 0 | 27 | | writer.WriteStartArray(); |
| 0 | 28 | | foreach (var item in Activities) |
| | 29 | | { |
| 0 | 30 | | writer.WriteObjectValue(item); |
| | 31 | | } |
| 0 | 32 | | writer.WriteEndArray(); |
| | 33 | | } |
| 0 | 34 | | writer.WriteEndObject(); |
| 0 | 35 | | } |
| | 36 | |
|
| | 37 | | internal static SwitchCase DeserializeSwitchCase(JsonElement element) |
| | 38 | | { |
| 0 | 39 | | Optional<string> value = default; |
| 0 | 40 | | Optional<IList<Activity>> activities = default; |
| 0 | 41 | | foreach (var property in element.EnumerateObject()) |
| | 42 | | { |
| 0 | 43 | | if (property.NameEquals("value")) |
| | 44 | | { |
| 0 | 45 | | value = property.Value.GetString(); |
| 0 | 46 | | continue; |
| | 47 | | } |
| 0 | 48 | | if (property.NameEquals("activities")) |
| | 49 | | { |
| 0 | 50 | | List<Activity> array = new List<Activity>(); |
| 0 | 51 | | foreach (var item in property.Value.EnumerateArray()) |
| | 52 | | { |
| 0 | 53 | | array.Add(Activity.DeserializeActivity(item)); |
| | 54 | | } |
| 0 | 55 | | activities = array; |
| | 56 | | continue; |
| | 57 | | } |
| | 58 | | } |
| 0 | 59 | | return new SwitchCase(value.Value, Optional.ToList(activities)); |
| | 60 | | } |
| | 61 | | } |
| | 62 | | } |