// <auto-generated/>

#nullable disable

using System;

namespace OpenAI.Responses
{
    internal static partial class ResponseStatusExtensions
    {
        public static string ToSerialString(this ResponseStatus value) => value switch
        {
            ResponseStatus.Completed => "completed",
            ResponseStatus.Failed => "failed",
            ResponseStatus.InProgress => "in_progress",
            ResponseStatus.Cancelled => "cancelled",
            ResponseStatus.Queued => "queued",
            ResponseStatus.Incomplete => "incomplete",
            _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ResponseStatus value.")
        };

        public static ResponseStatus ToResponseStatus(this string value)
        {
            if (StringComparer.OrdinalIgnoreCase.Equals(value, "completed"))
            {
                return ResponseStatus.Completed;
            }
            if (StringComparer.OrdinalIgnoreCase.Equals(value, "failed"))
            {
                return ResponseStatus.Failed;
            }
            if (StringComparer.OrdinalIgnoreCase.Equals(value, "in_progress"))
            {
                return ResponseStatus.InProgress;
            }
            if (StringComparer.OrdinalIgnoreCase.Equals(value, "cancelled"))
            {
                return ResponseStatus.Cancelled;
            }
            if (StringComparer.OrdinalIgnoreCase.Equals(value, "queued"))
            {
                return ResponseStatus.Queued;
            }
            if (StringComparer.OrdinalIgnoreCase.Equals(value, "incomplete"))
            {
                return ResponseStatus.Incomplete;
            }
            throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ResponseStatus value.");
        }
    }
}
