using System;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using FMSApp.Repositories;
using Quartz;
using FMSAdmin.Services;
using FMSAdmin.Data;
using System.Linq;
using FMSAdmin.Helpers;

namespace FMSAdmin.QuartzSchedule.Jobs {
    public class ClearTempFileJob : IJob {
        private readonly ILogger<ClearTempFileJob> _logger;
        private StorageHelper _storageHelper;

        public ClearTempFileJob(ILogger<ClearTempFileJob> logger, StorageHelper storageHelper) {
            _logger = logger;
            _storageHelper = storageHelper;
        }

        public Task Execute(IJobExecutionContext context) {
            //_logger.LogInformation("Execute!");

            _storageHelper.DeleteTempFiles();
            return Task.CompletedTask;
        }
    }
}