using Newtonsoft.Json;
using WK_KLI_LAPS_Service.App_Data;
using WK_KLI_LAPS_Service.Controllers.Master.StateCode;
using WK_KLI_LAPS_Service.Models.Configuration;
using WK_KLI_LAPS_Service.Models.Master;
using static WK_KLI_LAPS_Service.Controllers.Reports.ReportApiController;

namespace WK_KLI_LAPS_Service.Controllers.Configuration.Job.AutoArchiveJob
{
    public interface IAutoArchiveJobService
    {
        object GetAll();
        object GetActiveAutoArchiveJob();
        object Edit_AutoArchiveJob(autoarchivejobModel data);
        object Add_AutoArchiveJob(autoarchivejobModel data);
        object Active_AutoArchiveJob(autoarchivejobModel data);
        object GetJobTitle(manualarchivejobModel data);
        object Jobarchieve(manualarchivejobModel data);
    }
    public class AutoArchiveJobService : IAutoArchiveJobService
    {
        MasterRepository oMasterRepository = new MasterRepository();
        CommonRepository oCommonRepository = new CommonRepository();
        public object Active_AutoArchiveJob(autoarchivejobModel data)
        {
            string input = JsonConvert.SerializeObject(data);
            return oMasterRepository.Master_Frequency("spautoarchivejobmaster", input, "activeordeactive");
        }

        public object Add_AutoArchiveJob(autoarchivejobModel data)
        {
            string input = JsonConvert.SerializeObject(data);
            var res = oMasterRepository.Master_Frequency("spautoarchivejobmaster", input, "insert");
            return res;
        }

        public object Edit_AutoArchiveJob(autoarchivejobModel data)
        {
            string input = JsonConvert.SerializeObject(data);
            return oMasterRepository.Master_Frequency("spautoarchivejobmaster", input, "update");
        }
        public object GetActiveAutoArchiveJob()
        {
            return oMasterRepository.GetActive("autoarchivejob");
        }
        public object GetAll()
        {
            return oMasterRepository.Master_Frequency("spautoarchivejobmasterselect", "", "getall");
        }
        public object GetJobTitle(manualarchivejobModel data)
        {
            var input = JsonConvert.SerializeObject(data);
            return oCommonRepository.ExecuteSP_ReturnList("spjobmasterselect ", input, "getJobbypdiduserid");

        } 
        public object Jobarchieve(manualarchivejobModel data)
        {
            var input = JsonConvert.SerializeObject(data);
            return oCommonRepository.ExecuteSP_ReturnList1("spjobarchieve", input);
        }
    }
}
