using System;
using System.Collections.Generic;

namespace HRM.BO
{
    #region SchedularSetup

    public class SchedularSetup : BasicBaseObject
    {
        #region Constructor
        public SchedularSetup()
        {
            Title = string.Empty;
            MailBody = string.Empty;
            MailSubject = string.Empty;
            ToEmailAddress = new List<string>();
            Type = EnumSchedularType.None;
            ReportFormat = EnumSchedularReportFormat.None;
            _startAt = DateTime.MinValue;
        }
        #endregion

        #region Properties
        public string Title { get; set; }
        public string MailBody { get; set; }
        public string MailSubject { get; set; }
        public List<string> ToEmailAddress { get; set; }
        public EnumSchedularType Type { get; set; }
        public EnumSchedularReportFormat ReportFormat { get; set; }
        public DateTime? LastExecuteDateTime { get; set; }         
        public string Remarks { get; set; }
        public bool IsCCLM { get; set; }
        public bool IsCCCordinator { get; set; }
        public bool IsCCDeptHead { get; set; }
        public List<string> OnErrorMail { get; set; }
        public List<string> OtherEmailCC { get; set; }

        private DateTime _startAt;
        public DateTime StartAt
        {
            get { return new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, _startAt.Hour, _startAt.Minute, _startAt.Second); }
            set { _startAt = value; }
        }
        #endregion
    }
    #endregion

    #region MailNotificationHistory message
    public class MailNotificationHistory
    {
        public string? EmployeeNo { get; set; }
        public EnumSchedularType NotificationType { get; set; }
        public string Description { get; set; }
        public bool Status { get; set; }
        public string Email { get; set; }
        public DateTime SentTime { get; set; }
        public DateTime? LastUpdate { get; set; }

        public MailNotificationHistory(string pEmpNo, EnumSchedularType pNotificationType)
        {
            EmployeeNo = pEmpNo;
            NotificationType = pNotificationType;
            Description = "Successfully Sent";
            Status = true;
            this.LastUpdate = null;
        }
        public MailNotificationHistory()
        {

            Status = false;
            LastUpdate = DateTime.Now;
        }
    }
    #endregion

    #region ILeave Service
    public interface ISchedularSetupService
    {
        List<SchedularSetup> Get(EnumStatus status, EnumSchedularType Type, DateTime fromDate, DateTime toDate);
        SchedularSetup Get(int id);
        List<SchedularSetup> Get();
        List<SchedularSetup> Get(EnumStatus status);
        int Save(SchedularSetup oLeave);
        void Delete(int id);
        void SaveMailHistory(List<MailNotificationHistory> pMailNotificationHistory);
    }
    #endregion
}