
using JiShe.CollectBus;
using JiShe.CollectBus.Localization;
using Microsoft.Extensions.DependencyInjection;

namespace JiShe.CollectBusEPO
{
    [DependsOn(
        typeof(CollectBusEPOApplicationContractsModule),
        typeof(CollectBusEPOApplicationModule),
        typeof(AbpAspNetCoreMvcModule)
        )]
    public class CollectBusEPOHttpApiModule : AbpModule
    {
        public override void PreConfigureServices(ServiceConfigurationContext context)
        {
            PreConfigure<IMvcBuilder>(mvcBuilder =>
            {
                mvcBuilder.AddApplicationPartIfNotExists(typeof(CollectBusEPOHttpApiModule).Assembly);
            });

            Configure<AbpAspNetCoreMvcOptions>(options =>
            {
                options.ConventionalControllers
                    .Create(typeof(CollectBusEPOHttpApiModule).Assembly);
            });
        }

        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            Configure<AbpLocalizationOptions>(options =>
            {
                options.Resources
                    .Get<CollectBusResource>()
                    .AddBaseTypes(typeof(AbpUiResource));
            });
        }
    }
}
