import { ConfigModule } from '@nestjs/config';
import { CqrsModule } from '@nestjs/cqrs';
import { MidtransController } from './infrastructure/midtrans.controller';
import { MidtransService } from './data/services/midtrans.service';
import { Global, Module } from '@nestjs/common';
import { TransactionReadService } from 'src/modules/transaction/transaction/data/services/transaction-read.service';
import { TypeOrmModule } from '@nestjs/typeorm';
import { CONNECTION_NAME } from 'src/core/strings/constants/base.constants';
import { TransactionModel } from 'src/modules/transaction/transaction/data/models/transaction.model';

@Global()
@Module({
  imports: [
    ConfigModule.forRoot(),
    CqrsModule,
    TypeOrmModule.forFeature([TransactionModel], CONNECTION_NAME.DEFAULT),
  ],
  controllers: [MidtransController],
  providers: [MidtransService, TransactionReadService],
  exports: [MidtransService],
})
export class MidtransModule {}
