// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT License.

// <auto-generated/>

#nullable disable

using System;

namespace SampleTypeSpec
{
    internal static partial class StringFixedEnumExtensions
    {
        /// <param name="value"> The value to serialize. </param>
        public static string ToSerialString(this StringFixedEnum value) => value switch
        {
            StringFixedEnum.One => "1",
            StringFixedEnum.Two => "2",
            StringFixedEnum.Four => "4",
            _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown StringFixedEnum value.")
        };

        /// <param name="value"> The value to deserialize. </param>
        public static StringFixedEnum ToStringFixedEnum(this string value)
        {
            if (StringComparer.OrdinalIgnoreCase.Equals(value, "1"))
            {
                return StringFixedEnum.One;
            }
            if (StringComparer.OrdinalIgnoreCase.Equals(value, "2"))
            {
                return StringFixedEnum.Two;
            }
            if (StringComparer.OrdinalIgnoreCase.Equals(value, "4"))
            {
                return StringFixedEnum.Four;
            }
            throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown StringFixedEnum value.");
        }
    }
}
