
#nullable enable

namespace Google.Gemini
{
    /// <summary>
    /// Source of the File.
    /// </summary>
    public enum FileSource
    {
        /// <summary>
        /// Indicates the file is generated by Google.
        /// </summary>
        Generated,
        /// <summary>
        /// Indicates the file is a registered, i.e. a Google Cloud Storage file.
        /// </summary>
        Registered,
        /// <summary>
        /// Used if source is not specified.
        /// </summary>
        SourceUnspecified,
        /// <summary>
        /// Indicates the file is uploaded by the user.
        /// </summary>
        Uploaded,
    }

    /// <summary>
    /// Enum extensions to do fast conversions without the reflection.
    /// </summary>
    public static class FileSourceExtensions
    {
        /// <summary>
        /// Converts an enum to a string.
        /// </summary>
        public static string ToValueString(this FileSource value)
        {
            return value switch
            {
                FileSource.Generated => "GENERATED",
                FileSource.Registered => "REGISTERED",
                FileSource.SourceUnspecified => "SOURCE_UNSPECIFIED",
                FileSource.Uploaded => "UPLOADED",
                _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
            };
        }
        /// <summary>
        /// Converts an string to a enum.
        /// </summary>
        public static FileSource? ToEnum(string value)
        {
            return value switch
            {
                "GENERATED" => FileSource.Generated,
                "REGISTERED" => FileSource.Registered,
                "SOURCE_UNSPECIFIED" => FileSource.SourceUnspecified,
                "UPLOADED" => FileSource.Uploaded,
                _ => null,
            };
        }
    }
}