using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Quartz;
using Quartz.Spi;
using FMSAdmin.Data;
using System.Linq;
using FMSAdmin.Helpers;

public class QuartzJobFactory : IJobFactory {

    private readonly IServiceProvider _provider;

    public QuartzJobFactory(IServiceProvider provider) {
        _provider = provider;
    }

    public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler) {
        return _provider.GetRequiredService<QuartzJobRunner>();
    }

    public void ReturnJob(IJob job) {
        /*
        if (job is IDisposable disposableJob) {
            disposableJob.Dispose();
        }
        */
    }
}