using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Quartz;
using wispro.sp.api.Job;
using wispro.sp.share;

namespace wispro.sp.api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [Authorize]
    public class SystemDataController : ControllerBase
    {
        public ApiSaveResponse StartImportData()
        {
            System.Threading.Tasks.Task.Run(() => new ImportReportJob().Execute(null));
            
            return new ApiSaveResponse()
            {
                Success = true
            };
        }

        public ApiSaveResponse UpdateJXData()
        {
            System.Threading.Tasks.Task.Run(() => new UpdateJXDataFromIPEasyJob().Execute(null));
            
            return new ApiSaveResponse()
            {
                Success = true
            };
        }

        public ApiSaveResponse SendInvaldDataMessage()
        {
            System.Threading.Tasks.Task.Run(() => new InvalidDataMessageJob().Execute(null));

            return new ApiSaveResponse()
            {
                Success = true
            };
        }
    }
}
