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

import { getApiPersistence } from '../../env';
import { InMemoryPaymentsPersistenceModule } from '../inmemory/InMemoryPaymentsPersistenceModule';
import { PostgresPaymentsPersistenceModule } from '../postgres/PostgresPaymentsPersistenceModule';

const selectedPersistenceModule =
  getApiPersistence() === 'postgres' ? PostgresPaymentsPersistenceModule : InMemoryPaymentsPersistenceModule;

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