import {
  AuditingRunner,
  AuditingRunnerDisabledImplementationService,
  CoreAddI18nConstraintService,
  CoreGetContentLanguageObjectService,
  CoreGetFallbackLangService,
  CoreGetLangsService,
  CoreGetSearchKeyLangService,
} from '@aurorajs.dev/core-back';
import { CacheModule } from '@nestjs/cache-manager';
import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { EventEmitterModule } from '@nestjs/event-emitter';
import { CoreGetFallbackLangFromJsonService, CoreGetLangsFromJsonService } from './modules';

@Module({
  imports: [
    CacheModule.register({ isGlobal: true, ttl: 0 }),
    ConfigModule.forRoot({
      isGlobal: true,
      envFilePath: ['.env'],
    }),
    EventEmitterModule.forRoot()
  ],
  providers: [
    CoreAddI18nConstraintService,
    CoreGetContentLanguageObjectService,
    CoreGetSearchKeyLangService,
    {
      provide: AuditingRunner,
      useClass: AuditingRunnerDisabledImplementationService,
    },
    {
      provide: CoreGetFallbackLangService,
      useClass: CoreGetFallbackLangFromJsonService,
    },
    {
      provide: CoreGetLangsService,
      useClass: CoreGetLangsFromJsonService,
    },
  ],
  exports: [
    AuditingRunner,
    CoreAddI18nConstraintService,
    CoreGetContentLanguageObjectService,
    CoreGetFallbackLangService,
    CoreGetLangsService,
    CoreGetSearchKeyLangService
  ],
})
export class SharedModule {}
