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

namespace Crawler
{
    public class Executer
    {
        public Settings Settings { get; set; }
        public bool IsAuthenticated { get; set; }
        private readonly ICrawler _crawler;

        public Executer(ICrawler crawler, Settings settings)
        {
            this.Settings = settings;
            this._crawler = crawler;
        }

        public bool Login()
        {
            this.IsAuthenticated = this._crawler.Login(this.Settings.Username, this.Settings.Password);
            return this.IsAuthenticated;
        }

        public bool GetEmail(Uri adreference)
        {
            return this._crawler.GetEmail(adreference);
        }
    }

    public class AuthenticationComplete : EventArgs
    {
        bool Authenticated { get; set; }
        string Error { get; set; }
    }

}
