using Abp.AutoMapper;
using Abp.Modules;
using Abp.Reflection.Extensions;
using MineTec.ProManager.Authorization;

namespace MineTec.ProManager
{
    [DependsOn(
        typeof(ProManagerCoreModule), 
        typeof(AbpAutoMapperModule))]
    public class ProManagerApplicationModule : AbpModule
    {
        public override void PreInitialize()
        {
            Configuration.Authorization.Providers.Add<ProManagerAuthorizationProvider>();
        }

        public override void Initialize()
        {
            var thisAssembly = typeof(ProManagerApplicationModule).GetAssembly();

            IocManager.RegisterAssemblyByConvention(thisAssembly);

            Configuration.Modules.AbpAutoMapper().Configurators.Add(
                // Scan the assembly for classes which inherit from AutoMapper.Profile
                cfg => cfg.AddMaps(thisAssembly)
            );
        }
    }
}
