// <auto-generated/>

#nullable disable

using System;

namespace OpenAI.Audio
{
    internal static partial class GeneratedSpeechFormatExtensions
    {
        public static string ToSerialString(this GeneratedSpeechFormat value) => value switch
        {
            GeneratedSpeechFormat.Mp3 => "mp3",
            GeneratedSpeechFormat.Opus => "opus",
            GeneratedSpeechFormat.Aac => "aac",
            GeneratedSpeechFormat.Flac => "flac",
            GeneratedSpeechFormat.Wav => "wav",
            GeneratedSpeechFormat.Pcm => "pcm",
            _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown GeneratedSpeechFormat value.")
        };

        public static GeneratedSpeechFormat ToGeneratedSpeechFormat(this string value)
        {
            if (StringComparer.OrdinalIgnoreCase.Equals(value, "mp3")) return GeneratedSpeechFormat.Mp3;
            if (StringComparer.OrdinalIgnoreCase.Equals(value, "opus")) return GeneratedSpeechFormat.Opus;
            if (StringComparer.OrdinalIgnoreCase.Equals(value, "aac")) return GeneratedSpeechFormat.Aac;
            if (StringComparer.OrdinalIgnoreCase.Equals(value, "flac")) return GeneratedSpeechFormat.Flac;
            if (StringComparer.OrdinalIgnoreCase.Equals(value, "wav")) return GeneratedSpeechFormat.Wav;
            if (StringComparer.OrdinalIgnoreCase.Equals(value, "pcm")) return GeneratedSpeechFormat.Pcm;
            throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown GeneratedSpeechFormat value.");
        }
    }
}
