/
EntityRecognitionSkill.SkillVersion.cs
84 lines (65 loc) · 3.75 KB
/
EntityRecognitionSkill.SkillVersion.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.ComponentModel;
namespace Azure.Search.Documents.Indexes.Models
{
public partial class EntityRecognitionSkill
{
#pragma warning disable CA1034 // Nested types should not be visible
/// <summary> Represents service version information of an <see cref="EntityRecognitionSkill"/>. </summary>
public readonly partial struct SkillVersion : IEquatable<SkillVersion>
{
private readonly string _value;
private const string V1Value = "#Microsoft.Skills.Text.EntityRecognitionSkill";
private const string V3Value = "#Microsoft.Skills.Text.V3.EntityRecognitionSkill";
/// <summary> Creates a new instance of <see cref="SkillVersion"/>. </summary>
/// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception>
public SkillVersion(string value)
{
_value = value ?? throw new ArgumentNullException(nameof(value));
}
/// <summary> <see cref="SkillVersion.V1"/> version of the <see cref="EntityRecognitionSkill"/> is deprecated. Use the <see cref="SkillVersion.V3"/> version instead. </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static SkillVersion V1 { get; } = new SkillVersion(V1Value);
/// <summary> Version 3 of the <see cref="EntityRecognitionSkill"/>. </summary>
public static SkillVersion V3 { get; } = new SkillVersion(V3Value);
/// <summary> Latest version of the <see cref="EntityRecognitionSkill"/>. </summary>
public static SkillVersion Latest { get; } = V3;
/// <inheritdoc />
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj) => obj is SkillVersion other && Equals(other);
/// <inheritdoc />
public bool Equals(SkillVersion other) =>
string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
/// <summary> Defines the equal-to comparison operator on <see cref="SkillVersion"/>. </summary>
public static bool operator ==(SkillVersion left, SkillVersion right) => left.Equals(right);
/// <summary> Defines the not-equal-to comparison operator on <see cref="SkillVersion"/>. </summary>
public static bool operator !=(SkillVersion left, SkillVersion right) => !(left == right);
/// <summary> Defines the greater-than-or-equal-to comparison operator on <see cref="SkillVersion"/>. </summary>
public static bool operator >=(SkillVersion left, SkillVersion right)
{
if (left == right)
return true;
if (left == Latest)
return true;
return false;
}
/// <summary> Defines the less-than-or-equal-to comparison operator on <see cref="SkillVersion"/>. </summary>
public static bool operator <=(SkillVersion left, SkillVersion right)
{
if (left == right)
return true;
return !(left >= right);
}
/// <summary> Converts a string to a <see cref="SkillVersion"/>. </summary>
public static implicit operator SkillVersion(string value) => new(value);
/// <inheritdoc />
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode() => _value?.GetHashCode() ?? 0;
/// <inheritdoc />
public override string ToString() => _value;
}
#pragma warning restore CA1034 // Nested types should not be visible
}
}