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

import { getApiPersistence } from '../../env';
import { InMemoryMediaPersistenceModule } from '../inmemory/InMemoryMediaPersistenceModule';
import { PostgresMediaPersistenceModule } from '../postgres/PostgresMediaPersistenceModule';

const selectedPersistenceModule =
  getApiPersistence() === 'postgres' ? PostgresMediaPersistenceModule : InMemoryMediaPersistenceModule;

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