import { Module } from "@nestjs/common";
import { HttpModule } from "@nestjs/axios";
import { TypeOrmModule } from "@nestjs/typeorm";
import { NotificationOutbox } from "./entities/notification-outbox.entity";
import { OutboxRelayService } from "./outbox-relay.service";
import { OutboxRepository } from "./outbox.repository";
import { HttpPaymentEventPublisher } from "./publisher/http-payment-event-publisher";
import { PAYMENT_EVENT_PUBLISHER } from "./publisher/payment-event-publisher";

@Module({
  imports: [TypeOrmModule.forFeature([NotificationOutbox]), HttpModule],
  providers: [
    OutboxRepository,
    OutboxRelayService,
    // Swap to RabbitPaymentEventPublisher here when the broker lands — nothing else changes.
    { provide: PAYMENT_EVENT_PUBLISHER, useClass: HttpPaymentEventPublisher },
  ],
  exports: [OutboxRepository],
})
export class OutboxModule {}
