| | 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 | |
|
| | 10 | | namespace Azure.AI.FormRecognizer.Models |
| | 11 | | { |
| | 12 | | internal static class FieldValueTypeExtensions |
| | 13 | | { |
| 0 | 14 | | public static string ToSerialString(this FieldValueType value) => value switch |
| 0 | 15 | | { |
| 0 | 16 | | FieldValueType.String => "string", |
| 0 | 17 | | FieldValueType.Date => "date", |
| 0 | 18 | | FieldValueType.Time => "time", |
| 0 | 19 | | FieldValueType.PhoneNumber => "phoneNumber", |
| 0 | 20 | | FieldValueType.Float => "number", |
| 0 | 21 | | FieldValueType.Int64 => "integer", |
| 0 | 22 | | FieldValueType.List => "array", |
| 0 | 23 | | FieldValueType.Dictionary => "object", |
| 0 | 24 | | _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown FieldValueType value.") |
| 0 | 25 | | }; |
| | 26 | |
|
| | 27 | | public static FieldValueType ToFieldValueType(this string value) |
| | 28 | | { |
| 1292 | 29 | | if (string.Equals(value, "string", StringComparison.InvariantCultureIgnoreCase)) return FieldValueType.Strin |
| 316 | 30 | | if (string.Equals(value, "date", StringComparison.InvariantCultureIgnoreCase)) return FieldValueType.Date; |
| 300 | 31 | | if (string.Equals(value, "time", StringComparison.InvariantCultureIgnoreCase)) return FieldValueType.Time; |
| 292 | 32 | | if (string.Equals(value, "phoneNumber", StringComparison.InvariantCultureIgnoreCase)) return FieldValueType. |
| 412 | 33 | | if (string.Equals(value, "number", StringComparison.InvariantCultureIgnoreCase)) return FieldValueType.Float |
| 0 | 34 | | if (string.Equals(value, "integer", StringComparison.InvariantCultureIgnoreCase)) return FieldValueType.Int6 |
| 100 | 35 | | if (string.Equals(value, "array", StringComparison.InvariantCultureIgnoreCase)) return FieldValueType.List; |
| 104 | 36 | | if (string.Equals(value, "object", StringComparison.InvariantCultureIgnoreCase)) return FieldValueType.Dicti |
| 0 | 37 | | throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown FieldValueType value."); |
| | 38 | | } |
| | 39 | | } |
| | 40 | | } |