﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Eventing.Reader;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LivingEmpires.Data;
using WorldBankBBS.Logic;
using WorldBankBBS.Translators;

namespace LivingEmpires.Main
{
    public class LivingEmpiresMain : IDisposable
    {
        private Session _session;
        private ITranslator _translator;
        private LivingEmpiresHelper _empiresHelper;
        private bool _disposed;
        private LivingEmpiresHelper _mh;

        private static LivingEmpiresWorker s_worker = null;

        public LivingEmpiresMain()
        {
            if (s_worker == null)
            {
                s_worker = LivingEmpiresWorker.Instance;
                s_worker.Start();
            }

            _mh = new LivingEmpiresHelper();
        }

        public void EnterGame(Session session)
        {
            _session = session;
            _translator = session.Encoding.GetTranslator(session);


        }

        public void Dispose()
        {
            if (!_disposed)
            {
                _disposed = true;
                s_worker?.Stop();
                _mh?.Dispose();
            }
        }
    }
}
