import { Module } from '@nestjs/common';

import { getApiPersistence } from '../../env';
import { InMemoryNotificationsPersistenceModule } from '../inmemory/InMemoryNotificationsPersistenceModule';
import { PostgresNotificationsPersistenceModule } from '../postgres/PostgresNotificationsPersistenceModule';

const selectedPersistenceModule =
  getApiPersistence() === 'postgres' ? PostgresNotificationsPersistenceModule : InMemoryNotificationsPersistenceModule;

@Module({
  imports: [selectedPersistenceModule],
  exports: [selectedPersistenceModule],
})
export class NotificationsPersistenceModule {}