using Alipay.EasySDK.Kernel;
using LifePayment.Application;
using LifePayment.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Serilog;
using Volo.Abp;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity;
using Volo.Abp.IdentityServer.EntityFrameworkCore;
using Volo.Abp.Modularity;

namespace LifePayment.Worker
{
    [DependsOn(typeof(AbpBaseFrameworkModule))]
    [DependsOn(typeof(LifePaymentServicesApplicationModule),
               typeof(AbpEntityFrameworkCoreModule),
               typeof(AbpIdentityApplicationModule),
               typeof(AbpIdentityServerEntityFrameworkCoreModule),
               typeof(LifePaymentServicesEntityFrameworkCoreModule))]
    public class LifePaymentServicesWorkModule : AbpModule
    {
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            var configuration = context.Services.GetConfiguration();
            Configure<AbpDbContextOptions>(options =>
            {
                options.UseSqlServer();
            });
            context.Services.AddLogging(c =>
            {
                c.AddSerilog();
                c.AddConsole().SetMinimumLevel(LogLevel.Warning);
            });

            Configure<Config>(configuration.GetSection("AliPay"));
        }

        public async override Task OnApplicationInitializationAsync(ApplicationInitializationContext context)
        {

        }
    }
}