using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FiestaBot.Utilities
{
    internal class Logger
    {
        public static void Log(LogType Type, string Message, params object[] args)
        {
            Message = string.Format(Message, args);
            ConsoleColor Color = LogColor(Type);

            string Time = DateTime.Now.ToShortTimeString();

            Console.ForegroundColor = Color;
            Console.WriteLine("[{0}] [{1}] {2}", Time, Type, Message);
            
            Console.ForegroundColor = ConsoleColor.White;
        }

        private static ConsoleColor LogColor(LogType Type)
        {
            switch((byte)Type)
            {
                //program stuff
                case 0: return ConsoleColor.Green;
                case 1: return ConsoleColor.Green;
                case 2: return ConsoleColor.Green;
                case 3: return ConsoleColor.DarkGray;
                case 4: return ConsoleColor.White;
                case 5: return ConsoleColor.DarkCyan;
                case 6: return ConsoleColor.Cyan;
                case 7: return ConsoleColor.Red;
                //chat
                case 8: return ConsoleColor.White; //normal
                case 9: return ConsoleColor.DarkCyan; //party
                case 10: return ConsoleColor.Green; //guild
                case 11: return ConsoleColor.DarkRed; //acad
                case 12: return ConsoleColor.Magenta; //whisper
                case 13: return ConsoleColor.Yellow; //shout
                case 14: return ConsoleColor.Yellow; //notice
                //char
                case 15: return ConsoleColor.Yellow;
                //mapobjs
                case 16: return ConsoleColor.DarkMagenta;
                case 17: return ConsoleColor.DarkMagenta;
                case 18: return ConsoleColor.DarkMagenta;
                //dbg
                case 19: return ConsoleColor.DarkGray;
                //stndrd
                default: return ConsoleColor.White;
            }
        }
    }

    public enum LogType : byte
    {
        Program = 0,
        Config = 1,
        SHN = 2,
        Socket = 3,
        Login = 4,
        World = 5,
        Zone = 6,
        Error = 7,
        ChatNormal = 8,
        ChatParty = 9,
        ChatGuild = 10,
        ChatAcad = 11,
        ChatWhisper = 12,
        ChatShout = 13,
        Notice = 14,
        Character = 15,
        ObjGate = 16,
        ObjPly = 17,
        ObjMob = 18,
        Debug = 19
    }
}
