using System;

namespace Volpe.Cafe.Logging
{
    /// <summary>
    /// Specifies the level of logging to use.
    /// </summary>
    [Serializable]
    public enum LogLevel
    {
        /// <summary>
        /// Specifies that logging should be disabled.
        /// </summary>
        Disabled = 0,

        /// <summary>
        /// Specifies a minimal level of logging, where only the "Summary.txt", "Warnings.txt", and "Errors.txt" log
        /// files are generated.
        /// </summary>
        Minimal = 1,
        /// <summary>
        /// Specifies a default level of logging, where all <see cref="Minimal"/> logs are generated, along with the
        /// compliance finding (CF), credit trading, and all other custom log files.
        /// </summary>
        Default = 2,
        /// <summary>
        /// Specifies a debug level of logging, where all <see cref="Minimal"/> and <see cref="Default"/> logs are
        /// generated, along with all custom debugging log files.
        /// </summary>
        Debug = 3,

        //----- aliases -----
        /// <inheritdoc cref="Minimal"/>
        L1 = Minimal,
        /// <inheritdoc cref="Default"/>
        L2 = Default,
        /// <inheritdoc cref="Debug"/>
        L3 = Debug
    }

    /// <summary>
    /// Provides extension methods for various enumerations.
    /// </summary>
    [Serializable]
    public static class EnumExtensions
    {
        /// <summary>
        /// Determines whether the specified <see cref="LogLevel"/> instance is <see cref="LogLevel.Disabled"/>.
        /// </summary>
        public static bool IsDisabled(this LogLevel src) => (src == LogLevel.Disabled);

        /// <summary>
        /// Determines whether the specified <see cref="LogLevel"/> instance is <see cref="LogLevel.Minimal"/>.
        /// </summary>
        public static bool IsMinimal(this LogLevel src) => (src == LogLevel.Minimal);

        /// <summary>
        /// Determines whether the specified <see cref="LogLevel"/> instance is <see cref="LogLevel.Default"/>.
        /// </summary>
        public static bool IsDefault(this LogLevel src) => (src == LogLevel.Default);

        /// <summary>
        /// Determines whether the specified <see cref="LogLevel"/> instance is <see cref="LogLevel.Debug"/>.
        /// </summary>
        public static bool IsDebug(this LogLevel src) => (src == LogLevel.Debug);

    }
}
