// <auto-generated/>

#nullable disable

using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using OpenAI;

namespace OpenAI.Chat
{
    [Experimental("OPENAI001")]
    public readonly partial struct ChatCompletionCollectionOrder : IEquatable<ChatCompletionCollectionOrder>
    {
        private readonly string _value;
        private const string AscendingValue = "asc";
        private const string DescendingValue = "desc";

        public ChatCompletionCollectionOrder(string value)
        {
            Argument.AssertNotNull(value, nameof(value));

            _value = value;
        }

        public static ChatCompletionCollectionOrder Ascending { get; } = new ChatCompletionCollectionOrder(AscendingValue);

        public static ChatCompletionCollectionOrder Descending { get; } = new ChatCompletionCollectionOrder(DescendingValue);

        public static bool operator ==(ChatCompletionCollectionOrder left, ChatCompletionCollectionOrder right) => left.Equals(right);

        public static bool operator !=(ChatCompletionCollectionOrder left, ChatCompletionCollectionOrder right) => !left.Equals(right);

        public static implicit operator ChatCompletionCollectionOrder(string value) => new ChatCompletionCollectionOrder(value);

        [EditorBrowsable(EditorBrowsableState.Never)]
        public override bool Equals(object obj) => obj is ChatCompletionCollectionOrder other && Equals(other);

        public bool Equals(ChatCompletionCollectionOrder other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);

        [EditorBrowsable(EditorBrowsableState.Never)]
        public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0;

        public override string ToString() => _value;
    }
}
