using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using SlnMesnac.Rfid.Factory;

namespace SlnMesnac.Rfid
{
    public static class RfidSetup
    {
        public static void AddRfidSetup(this IServiceCollection services)
        {
            services.AddSingleton<RfidPool>();

            services.AddSingleton<RflyFactory>();
        }

        public static IApplicationBuilder UseRfidExtensions(this IApplicationBuilder app)
        {
            var pool = app.ApplicationServices.GetService<RfidPool>();
            pool.Init();
            return app;
        }
    }
}