using System;

namespace Zone_Fix
{
    class ConsoleWriter
    {
        public void WriteLine(WriteType Type, Boolean NewLine, String Message, params Object[] Arguments)
        {
            String FormattedMessage = String.Format(Message, Arguments);
            String Name = WriteName(Type);
            String Line = String.Format("[{0}] ({1}) {2}", DateTime.Now.ToString("dd:MM || HH:mm"), Name, FormattedMessage);
            ConsoleColor Color = WriteColor(Type);

            Console.ForegroundColor = Color;
            Console.WriteLine(Line);

            if (NewLine) { Console.WriteLine(); }
        }

        public void WriteBlank(Boolean NewLine, String Message, params Object[] Arguments)
        {
            String FormattedMessage = String.Format(Message, Arguments);
            String Line = String.Format("[{0}] {1}", DateTime.Now.ToString("dd:MM || HH:mm"), FormattedMessage);

            Console.ForegroundColor = ConsoleColor.DarkCyan;
            Console.WriteLine(Line);

            if (NewLine) { Console.WriteLine(); }
        }

        private ConsoleColor WriteColor(WriteType Type)
        {
            switch (Type)
            {
                case WriteType.Information:
                    {
                        return ConsoleColor.Green;
                    }
                case WriteType.Debug:
                    {
                        return ConsoleColor.Magenta;
                    }
                case WriteType.Error:
                    {
                        return ConsoleColor.Red;
                    }
                default:
                    {
                        return ConsoleColor.White;
                    }
            }
        }

        private String WriteName(WriteType Type)
        {
            switch (Type)
            {
                case WriteType.Information:
                    {
                        return "Info";
                    }
                case WriteType.Debug:
                    {
                        return "Debug";
                    }
                case WriteType.Error:
                    {
                        return "Error";
                    }
                default:
                    {
                        return "Unknown";
                    }
            }
        }
    }

    enum WriteType
    {
        Information,
        Error,
        Debug,
    }
}
