|  |  | 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; | 
|  |  | 9 |  | using System.Text.Json; | 
|  |  | 10 |  | using Azure.Core; | 
|  |  | 11 |  |  | 
|  |  | 12 |  | namespace Azure.ResourceManager.Storage.Models | 
|  |  | 13 |  | { | 
|  |  | 14 |  |     public partial class EncryptionService : IUtf8JsonSerializable | 
|  |  | 15 |  |     { | 
|  |  | 16 |  |         void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) | 
|  |  | 17 |  |         { | 
|  | 92 | 18 |  |             writer.WriteStartObject(); | 
|  | 92 | 19 |  |             if (Enabled != null) | 
|  |  | 20 |  |             { | 
|  | 76 | 21 |  |                 writer.WritePropertyName("enabled"); | 
|  | 76 | 22 |  |                 writer.WriteBooleanValue(Enabled.Value); | 
|  |  | 23 |  |             } | 
|  | 92 | 24 |  |             if (LastEnabledTime != null) | 
|  |  | 25 |  |             { | 
|  | 0 | 26 |  |                 writer.WritePropertyName("lastEnabledTime"); | 
|  | 0 | 27 |  |                 writer.WriteStringValue(LastEnabledTime.Value, "O"); | 
|  |  | 28 |  |             } | 
|  | 92 | 29 |  |             if (KeyType != null) | 
|  |  | 30 |  |             { | 
|  | 16 | 31 |  |                 writer.WritePropertyName("keyType"); | 
|  | 16 | 32 |  |                 writer.WriteStringValue(KeyType.Value.ToString()); | 
|  |  | 33 |  |             } | 
|  | 92 | 34 |  |             writer.WriteEndObject(); | 
|  | 92 | 35 |  |         } | 
|  |  | 36 |  |  | 
|  |  | 37 |  |         internal static EncryptionService DeserializeEncryptionService(JsonElement element) | 
|  |  | 38 |  |         { | 
|  | 1684 | 39 |  |             bool? enabled = default; | 
|  | 1684 | 40 |  |             DateTimeOffset? lastEnabledTime = default; | 
|  | 1684 | 41 |  |             KeyType? keyType = default; | 
|  | 13472 | 42 |  |             foreach (var property in element.EnumerateObject()) | 
|  |  | 43 |  |             { | 
|  | 5052 | 44 |  |                 if (property.NameEquals("enabled")) | 
|  |  | 45 |  |                 { | 
|  | 1684 | 46 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|  |  | 47 |  |                     { | 
|  |  | 48 |  |                         continue; | 
|  |  | 49 |  |                     } | 
|  | 1684 | 50 |  |                     enabled = property.Value.GetBoolean(); | 
|  | 1684 | 51 |  |                     continue; | 
|  |  | 52 |  |                 } | 
|  | 3368 | 53 |  |                 if (property.NameEquals("lastEnabledTime")) | 
|  |  | 54 |  |                 { | 
|  | 1684 | 55 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|  |  | 56 |  |                     { | 
|  |  | 57 |  |                         continue; | 
|  |  | 58 |  |                     } | 
|  | 1684 | 59 |  |                     lastEnabledTime = property.Value.GetDateTimeOffset("O"); | 
|  | 1684 | 60 |  |                     continue; | 
|  |  | 61 |  |                 } | 
|  | 1684 | 62 |  |                 if (property.NameEquals("keyType")) | 
|  |  | 63 |  |                 { | 
|  | 1684 | 64 |  |                     if (property.Value.ValueKind == JsonValueKind.Null) | 
|  |  | 65 |  |                     { | 
|  |  | 66 |  |                         continue; | 
|  |  | 67 |  |                     } | 
|  | 1684 | 68 |  |                     keyType = new KeyType(property.Value.GetString()); | 
|  |  | 69 |  |                     continue; | 
|  |  | 70 |  |                 } | 
|  |  | 71 |  |             } | 
|  | 1684 | 72 |  |             return new EncryptionService(enabled, lastEnabledTime, keyType); | 
|  |  | 73 |  |         } | 
|  |  | 74 |  |     } | 
|  |  | 75 |  | } |