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

namespace HRM.BO
{

    
    public enum EnumwfStatus
    {
        // Do not change without discuss to shamim
        Initiate = 0,
        Received = 1,
        Revert = 2,
        Reject = 3,
        Approve = 4,
        Halt = 5,
        Recomendation = 6,
        End = 7
    }



    public enum EnumWFActorType
    {
        Not_Defined=0,
        AnyEmployee = 1,
        LineManager = 2,
        Employee = 3,
        OrganogramNode = 4,
        PositionType = 5,
        ListField = 6
    }

    public enum EnumwfLogicOperator
    {
        No_Operator = 0,
        Equal = 1,
        Greater = 2,
        Less = 3,
        LessOrEqual = 4,
        Not_Null = 5,
        Null = 6,
        SourceFieldTrue=7,
        SourceFiledFalse=8
    }

    public enum EnumWFTaskType {
        Email_forNotification=1,
        Email_ForPendingJob=2,
        Web_Notification=2,
        }
    public enum EnumwfLogicAction
    {

        InValidAction =0,
        NextStep=1,
        Complete = 2,
        GoToStep = 3,
        Recomendation=4
    }

    public enum EnumWFAmountType
    {
        Amount=1,

    }
    public enum EnumAlternateActionType
    {
        None=0,
        Delegation =1,
        Admin =2
    }
    #region class

    //public class WorkflowType
    //{
    //    public int WorkFlowTypeID { get; set; }
    //    public string Name { get; set; }
    //    public string Description { get; set; }
    //    public int STATUSUPDATETABLE { get; set; }
    //    public int STATUSUPDATECOLUMN { get; set; }
    //    public string WEBPAGELINK { get; set; }
    //    public int STATUSUPDATETABLEPK { get; set; }
    //    public string SourceObjectName { get; set; }
    //    public string PKGetFunctionName { get; set; }
    //}

    public class WFRule : BasicBaseObject
    {
        public WFRule ()
        {
        }
        #region properties
        public int WFRuleID { get; set; }

        public int WFTypeID { get; set; }
        public int Weightage { get; set; }
        public List<WFRule.WFStep> Steps { get; set; }

        public int? WFAdminEmpID { get; set; }

        public int? delayDaysToNofityAdmin { get; set; }
        public int? delayDaysToNotifyInitiator { get; set; }

        #endregion

        #region sub-class

     

        public class WFStep
        {
            public WFStep ()
            {
                this.ReqAppAll = false;
                this.Amount = 0;
                this.StepSequeceNo = 0;
                this.Operator = EnumwfLogicOperator.No_Operator;
                this.Action = EnumwfLogicAction.InValidAction;
                this.description = "";
            }
            public int wfruleID { get; set; }
            public int wfruleStepID { get; set; }
            public List<WFStepActor> Actors { get; set; }
            public int StepSequeceNo { get; set; }
            public int StepNo { get; set; }
            public string description { get; set; }
            public bool ReqAppAll { get; set; }
            public string ListActionFieldName { get; set; } 
            public double Amount { get; set; }
            public EnumwfLogicOperator Operator { get; set; }
            public EnumwfLogicAction Action { get; set; }
            public int GoToStepNo { get; set; }

            public int? RecomendationEmpID { get; set; }
            public string RecomendationListFieildID { get; set; }

            public int ApproveWithinDays { get; set; }
            public int MailBeforeApproveDays { get; set; }

            public bool AlwaysNotifyToInitiator { get; set; }
            public bool NofityAll { get; set; }
            public string AddtionalNotifyEmpID { get; set; }
            public string AdditionalText { get; set; }
            public string FieldNamesforMail { get; set; }

            public class WFStepActor
            {
                public int WFStepActorID { get; set; }
                public int WFRuleID { get; set; }
                public EnumWFActorType WFActorType { get; set; }
                public int WFStepID { get; set; }
                public long ObjectID { get; set; }
                public string StepName { get; set; }
                public string ListFieldName { get; set; }

            }

        

        }

  
        #endregion


    }
    #endregion

    public interface IWFRuleService
    {
        WFRule Get(int wfid);
        List<WFRule> GetRules(int wftypeid);
        List<WFRule> Get();
        int Save(WFRule wfrule);
        void Delete(int ruleid);

    }


}