import { Module } from "@nestjs/common";
import { TypeOrmModule } from "@nestjs/typeorm";
import { ProvidersModule } from "../providers/providers.module";
import { NotificationOutbox } from "../outbox/entities/notification-outbox.entity";
import { PaymentIntent } from "./entities/payment-intent.entity";
import { IntentsController } from "./intents.controller";
import { IntentsRepository } from "./intents.repository";
import { IntentsService } from "./intents.service";

@Module({
  // NotificationOutbox is registered here because terminal transitions insert outbox rows
  // inside the intent-finalizing transaction (transactional outbox).
  imports: [
    TypeOrmModule.forFeature([PaymentIntent, NotificationOutbox]),
    ProvidersModule,
  ],
  controllers: [IntentsController],
  providers: [IntentsService, IntentsRepository],
  exports: [IntentsService, IntentsRepository],
})
export class IntentsModule {}
