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

import { getApiPersistence } from '../../env';
import { InMemoryAnalyticsPersistenceModule } from '../inmemory/InMemoryAnalyticsPersistenceModule';
import { PostgresAnalyticsPersistenceModule } from '../postgres/PostgresAnalyticsPersistenceModule';

const selectedPersistenceModule =
  getApiPersistence() === 'postgres' ? PostgresAnalyticsPersistenceModule : InMemoryAnalyticsPersistenceModule;

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