// <auto-generated/>

#nullable disable

using System;

namespace OpenAI.Assistants
{
    internal static partial class MessageRoleExtensions
    {
        public static string ToSerialString(this Assistants.MessageRole value) => value switch
        {
            Assistants.MessageRole.User => "user",
            Assistants.MessageRole.Assistant => "assistant",
            _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown MessageRole value.")
        };

        public static Assistants.MessageRole ToMessageRole(this string value)
        {
            if (StringComparer.OrdinalIgnoreCase.Equals(value, "user"))
            {
                return Assistants.MessageRole.User;
            }
            if (StringComparer.OrdinalIgnoreCase.Equals(value, "assistant"))
            {
                return Assistants.MessageRole.Assistant;
            }
            throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown MessageRole value.");
        }
    }
}
