using Ease.Core.DataAccess;
using Ease.Core.Model;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;

namespace HRM.BO
{
    public class DataIntegrationHeader
    {
        public DataIntegrationHeader() { }

        public string PermissionKEY { get; set; }
        public string RequestKEY { get; set; } // UserID # PayrollTypeID 
        public List<DataIntegration> Items { get; set; }
    }

    public class DataIntegration
    {
        public string UploadDate { get; set; }
        public string EmployeeNo { get; set; } 
        public string GlobalID { get; set; }
        public string PreviousEmployeeNo { get; set; }
        public string ContractChangeEndDate { get; set; }
        public string EmployeeName { get; set; }
        public string FathersName { get; set; }
        public string DesignationCode { get; set; }
        public string Designation { get; set; }
        public string DateOfBirth { get; set; }
        public string DateOfJoining { get; set; }
        public string DiscontinueDateRegion { get; set; }
        public string ConfirmationDate { get; set; }
        public string TerminationDate { get; set; }
        public string CategoryCode { get; set; }
        public string Category { get; set; }
        public string ReligionCode { get; set; }
        public string Religion { get; set; }
        public string MaritalStatus { get; set; }
        public string Gender { get; set; }
        public string TIN { get; set; }
        public string IsForeignExpatriate { get; set; }
        public string Grade { get; set; }
        public string GradeCode { get; set; }
        public string BasicSalary { get; set; }
        public string SpecialAllowance { get; set; }
        public string BasicSalaryEffectDate { get; set; }
        public string SALARY_CHANGE_TYPE { get; set; }
        public string DivisionCode { get; set; }
        public string Division { get; set; }
        public string DepartmentCode { get; set; }
        public string Department { get; set; }
        public string BusinessUnitCode { get; set; }
        public string BusinessUnitName { get; set; }
        public string SubDepartmentCode { get; set; }
        public string SubDepartment { get; set; }
        public string SectionCode { get; set; }
        public string Section { get; set; }
        public string SubSectionCode { get; set; }
        public string SubSection { get; set; }
        public string UnitCode { get; set; }
        public string Unit { get; set; }
        public string SubUnitCode { get; set; }
        public string SubUnit { get; set; }
        public string ZoneCode { get; set; }
        public string Zone { get; set; }
        public string LocationCode { get; set; }
        public string Location { get; set; }
        public string CostCenterCode { get; set; }
        public string CostCenterName { get; set; }
        public string AssignmentChangeDate { get; set; }
        public string SalaryBankCode { get; set; }
        public string SalaryBank { get; set; }
        public string SalaryBranchCode { get; set; }
        public string SalaryBranch { get; set; }
        public string SalaryAccountNumber { get; set; }
        public string SALARY_ACCOUNT_EFFECT_DATE { get; set; }
        public string EmailAddress { get; set; }
        public string MobileNo { get; set; }
        public string CompanyCode { get; set; }
        public string Company { get; set; }
        public string BatchID { get; set; }
        public string GrossSalary { get; set; }
        public string RegionCode { get; set; }
        public string RegionName { get; set; }
        public string PFMembership { get; set; }
        public string OPIBankName { get; set; }
        public string OPIBranchName { get; set; }
        public string OPIAccountNumber { get; set; }
        public string AccessCardID { get; set; }
        public string Shift { get; set; }
        public string LineManagerID { get; set; }

        public string LIFE_CYCLE_EVENT { get; set; }
        public string PayScaleLevelCode { get; set; }
        public string PayScaleLevel { get; set; }
        public int payrolltypeid { get; set; }
    }

    public class DataIntergrationIndividualAllowanceHeader
    {
        public DataIntergrationIndividualAllowanceHeader() { }

        public string PermissionKEY { get; set; }
        public string RequestKEY { get; set; } // UserID # PayrollTypeID 
        public List<DataIntergrationIndividualAllowance> Items { get; set; }

    }

    public class DataIntergrationIndividualAllowance
    {
        public DataIntergrationIndividualAllowance() { }
        public string EmployeeNo { get; set; }
        public int RowNo { get; set; }
        public int payrolltypeid { get; set; }
        public List<ComnpData> Items { get; set; }

    }


    public class ComnpData
    {
        public string BenifitCode { get; set; }
        public string ItemName { get; set; }
        public string FromDate { get; set; }
        public string ToDate { get; set; }
        public string Amount { get; set; }
        public string Grade { get; set; }
        public string EmployeeNo { get; set; }
    }



    public class EmployeeData
    {
        public string EMPLOYEE_NO { get; set; }
        public string RowNo { get; set; }
        public List<compdata> COMP_DATA { get; set; }
    }

    public class compdata
    {
        public string ITEM_CODE { get; set; }
        public string ITEM_NAME { get; set; }
        public string AMOUNT { get; set; }
        public string FROM_DATE { get; set; }
        public string TO_DATE { get; set; }
    }

    public class IndividualAllowanceModel
    {
        public List<EmployeeData> row { get; set; }
    }



    public interface IDataIntergrationRequestService
    {
        string SaveBulkRequest(List<DataIntegration> datas);
        void BulkSave(List<SuccessorErrorList> items);
        void ImportEmpBasicInfo(List<DataIntegration> odataTable, int payrollTypeID, int userid);
        void ImportEmpIndividualAllowanceDeduction(int payrollTypeID,EnumAllowOrDeduct type, 
            List<DataIntergrationIndividualAllowance> odataTable, string selectedEmp);
        string BulkSaveIndividualAllowance(List<DataIntergrationIndividualAllowance> items);
        List<UploadErrorOrSuccess> getErrorList();
        List<SuccessorErrorList> getErrorORSuccessList();
        void Save(int nPayrollTypeID, int userid, EnumRegularDataUpload uploaid);
        DataSet GetSuccessorErrorData(string batchId);
        DataSet GetBudgetData(int payrolltypeid);
        DataSet GetBudgetDataAllowance(int payrolltypeid);

    }

    public interface IApiIntegrationService
    {
        Task<Token> GetAccessTokenAsync();
        Task<DataIntegrationHeader> GetMasterDataAsync(string accessToken);
        //  Task<DataIntergrationIndividualAllowanceHeader> GetConpensationDataAsync(string accessToken);
        Task<IndividualAllowanceModel> GetConpensationDataAsync(string accessToken);
    }

    public class Token
    {
        public string access_token { get; set; }

        public string token_type { get; set; }

        public string expires_in { get; set; }

        public string scope { get; set; }
    }

}