| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. See License.txt in the project root for |
| | 3 | | // license information. |
| | 4 | |
|
| | 5 | | namespace Microsoft.Azure.Search.Models |
| | 6 | | { |
| | 7 | | using Newtonsoft.Json; |
| | 8 | | using Newtonsoft.Json.Converters; |
| | 9 | | using System; |
| | 10 | | using System.Runtime.Serialization; |
| | 11 | |
|
| | 12 | | /// <summary> |
| | 13 | | /// Defines values for NamedEntityCategory. This is deprecated, use <see cref="EntityCategory"/> instead |
| | 14 | | /// </summary> |
| | 15 | | [JsonConverter(typeof(StringEnumConverter))] |
| | 16 | | [Obsolete("Use EntityCategory instead.")] |
| | 17 | | public enum NamedEntityCategory |
| | 18 | | { |
| | 19 | | [EnumMember(Value = "location")] |
| | 20 | | Location, |
| | 21 | | [EnumMember(Value = "organization")] |
| | 22 | | Organization, |
| | 23 | | [EnumMember(Value = "person")] |
| | 24 | | Person |
| | 25 | | } |
| | 26 | |
|
| | 27 | | [Obsolete("Use EntityCategoryEnumExtension instead.")] |
| | 28 | | internal static class NamedEntityCategoryEnumExtension |
| | 29 | | { |
| | 30 | | internal static string ToSerializedValue(this NamedEntityCategory? value) |
| | 31 | | { |
| 0 | 32 | | return value == null ? null : ((NamedEntityCategory)value).ToSerializedValue(); |
| | 33 | | } |
| | 34 | |
|
| | 35 | | internal static string ToSerializedValue(this NamedEntityCategory value) |
| | 36 | | { |
| | 37 | | switch (value) |
| | 38 | | { |
| | 39 | | case NamedEntityCategory.Location: |
| 0 | 40 | | return "location"; |
| | 41 | | case NamedEntityCategory.Organization: |
| 0 | 42 | | return "organization"; |
| | 43 | | case NamedEntityCategory.Person: |
| 0 | 44 | | return "person"; |
| | 45 | | } |
| 0 | 46 | | return null; |
| | 47 | | } |
| | 48 | |
|
| | 49 | | internal static NamedEntityCategory? ParseNamedEntityCategory(this string value) |
| | 50 | | { |
| | 51 | | switch (value) |
| | 52 | | { |
| | 53 | | case "location": |
| 0 | 54 | | return NamedEntityCategory.Location; |
| | 55 | | case "organization": |
| 0 | 56 | | return NamedEntityCategory.Organization; |
| | 57 | | case "person": |
| 0 | 58 | | return NamedEntityCategory.Person; |
| | 59 | | } |
| 0 | 60 | | return null; |
| | 61 | | } |
| | 62 | | } |
| | 63 | | } |