using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using PARR.Mail.Services;
using PARR.Mail.Settings;

namespace PARR.Mail
{
    public static class MailInstaller
    {
        public static void InstallMailServices(this IServiceCollection services, IConfiguration configuration)
        {
            var mailSettings = new MailSettings();
            configuration.GetSection(nameof(MailSettings)).Bind(mailSettings);
            services.AddSingleton(mailSettings);

            services.AddTransient<IMailService, MailService>();
        }
    }
}
