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

import { getApiPersistence } from '../../env';
import { InMemoryAdminPersistenceModule } from '../inmemory/InMemoryAdminPersistenceModule';
import { PostgresAdminPersistenceModule } from '../postgres/PostgresAdminPersistenceModule';

const selectedPersistenceModule =
  getApiPersistence() === 'postgres' ? PostgresAdminPersistenceModule : InMemoryAdminPersistenceModule;

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