| | 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.ComponentModel; |
| | 10 | |
|
| | 11 | | namespace Azure.Iot.Hub.Service.Models |
| | 12 | | { |
| | 13 | | /// <summary> The state of the device. </summary> |
| | 14 | | public readonly partial struct DeviceConnectionState : IEquatable<DeviceConnectionState> |
| | 15 | | { |
| | 16 | | private readonly string _value; |
| | 17 | |
|
| | 18 | | /// <summary> Determines if two <see cref="DeviceConnectionState"/> values are the same. </summary> |
| | 19 | | /// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception> |
| | 20 | | public DeviceConnectionState(string value) |
| | 21 | | { |
| 80 | 22 | | _value = value ?? throw new ArgumentNullException(nameof(value)); |
| 80 | 23 | | } |
| | 24 | |
|
| | 25 | | private const string DisconnectedValue = "Disconnected"; |
| | 26 | | private const string ConnectedValue = "Connected"; |
| | 27 | |
|
| | 28 | | /// <summary> Disconnected. </summary> |
| 0 | 29 | | public static DeviceConnectionState Disconnected { get; } = new DeviceConnectionState(DisconnectedValue); |
| | 30 | | /// <summary> Connected. </summary> |
| 0 | 31 | | public static DeviceConnectionState Connected { get; } = new DeviceConnectionState(ConnectedValue); |
| | 32 | | /// <summary> Determines if two <see cref="DeviceConnectionState"/> values are the same. </summary> |
| 0 | 33 | | public static bool operator ==(DeviceConnectionState left, DeviceConnectionState right) => left.Equals(right); |
| | 34 | | /// <summary> Determines if two <see cref="DeviceConnectionState"/> values are not the same. </summary> |
| 0 | 35 | | public static bool operator !=(DeviceConnectionState left, DeviceConnectionState right) => !left.Equals(right); |
| | 36 | | /// <summary> Converts a string to a <see cref="DeviceConnectionState"/>. </summary> |
| 0 | 37 | | public static implicit operator DeviceConnectionState(string value) => new DeviceConnectionState(value); |
| | 38 | |
|
| | 39 | | /// <inheritdoc /> |
| | 40 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| 0 | 41 | | public override bool Equals(object obj) => obj is DeviceConnectionState other && Equals(other); |
| | 42 | | /// <inheritdoc /> |
| 0 | 43 | | public bool Equals(DeviceConnectionState other) => string.Equals(_value, other._value, StringComparison.Invarian |
| | 44 | |
|
| | 45 | | /// <inheritdoc /> |
| | 46 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| 0 | 47 | | public override int GetHashCode() => _value?.GetHashCode() ?? 0; |
| | 48 | | /// <inheritdoc /> |
| 16 | 49 | | public override string ToString() => _value; |
| | 50 | | } |
| | 51 | | } |