using Hcs.WebApp.Data.Hcs;

namespace Hcs.WebApp.BackgroundServices.CampaignManagers
{
    public interface IManager
    {
        public delegate void CampaignStarted(int campaignId, DateTime startedAt);
        public delegate void CampaignProgressStep(int campaignId, int step, int progress);
        public delegate void CampaignEnded(int campaignId, Campaign.CampaignType type, DateTime endedAt, string failureReason);

        public enum ManagerState
        {
            Created,
            Started,
            Ended
        }

        public Campaign Campaign { get; }

        public ManagerState State { get; }

        event CampaignStarted OnCampaignStarted;
        event CampaignProgressStep OnCampaignProgressStep;
        event CampaignEnded OnCampaignEnded;

        Task ProcessAsync();

        Task EndWithFailAsync(Exception e);
    }
}
