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

namespace Remontor.Seacher
{
    internal class HistoryResult : ISeacherResult
    {
        private IComp Comp;
        private DateTime LastConnect;
        private string StrQuestion;
        public HistoryResult()
        {

        }
        public HistoryResult(IComp comp, DateTime lastConnect)
        {
            Comp = comp;
            LastConnect = lastConnect;
        }

        public HistoryResult(IComp comp, string lastConnect, string strQuestion)
        {
            Comp = comp;
            LastConnect = DateTime.Parse(lastConnect);
            StrQuestion = strQuestion;
        }

        public IComp GetComp() { 
            return Comp;
        }

        public DateTime GetLastConnect()
        {
            return LastConnect;
        }
        public string toString()
        {
            string buf;
            if (Comp.GetName() == null)
            {
                buf = Comp.GetNetNameStr();
            }
            else
            {
                buf = Comp.GetName();
                if (Comp.GetNetNameStr() != null) buf += "(" + Comp.GetNetNameStr() + ")";

            }
            return buf;
        }
        /// <summary>
        /// //////////////////
        /// </summary>
        /// <returns></returns>
        public IComp Result()
        {
            return Comp;
        }

        public string ResultString()
        {
            return StrQuestion;
        }
    }
}
