import { Module } from "@nestjs/common";
import { BullModule } from "@nestjs/bullmq";
import { UsersService } from "./application/users.service.js";
import { UserAuthRepository } from "./infra/user-auth.repository.js";
import { UserProfileAggregator } from "./infra/user-profile.service.js";
import { UsersController } from "./users.controller.js";
import { WhmcsModule } from "@bff/integrations/whmcs/whmcs.module.js";
import { SalesforceModule } from "@bff/integrations/salesforce/salesforce.module.js";
import { MappingsModule } from "@bff/modules/id-mappings/mappings.module.js";
import { PrismaModule } from "@bff/infra/database/prisma.module.js";
import { QUEUE_NAMES } from "@bff/infra/queue/queue.constants.js";
import { AddressReconcileQueueService } from "./queue/address-reconcile.queue.js";
import { AddressReconcileProcessor } from "./queue/address-reconcile.processor.js";

@Module({
  imports: [
    PrismaModule,
    WhmcsModule,
    SalesforceModule,
    MappingsModule,
    BullModule.registerQueue({ name: QUEUE_NAMES.RECONCILE }),
  ],
  controllers: [UsersController],
  providers: [
    UsersService,
    UserAuthRepository,
    UserProfileAggregator,
    AddressReconcileQueueService,
    AddressReconcileProcessor,
  ],
  exports: [UsersService, UserAuthRepository, UserProfileAggregator, AddressReconcileQueueService],
})
export class UsersModule {}
