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

namespace PG_Sim
{
    /// <summary>
    /// Errors storage 
    /// </summary>
    static class Loger
    {
        static private List<Error> errors = new List<Error>();

        public static void AddError(string error_text, byte type)
        {
            //Error new_error = new Error(error_text, type);
            //errors.Add(new_error);
        }

        public static string PrintAll()
        {
            string toReturn = "";
            List<Error> copy_errors = new List<Error>(errors);
            copy_errors.Reverse();
            foreach (Error error in copy_errors)
            {
                toReturn += error.Date() + ": " + error.Text() + "\n";
            }
            return toReturn;
        }

        class Error
        {
            private string text;
            private byte type;
            private DateTime date;

            public Error(string error_text, byte type)
            {
                this.text = error_text;
                this.type = type;
                this.date = System.DateTime.Now;
            }
            public string Text()
            {
                return this.text;
            }
            public string Date()
            {
                return this.date.ToString("T");
            }
        }
    }
}
