import { Module } from "@nestjs/common";
import { ConfigModule } from "@nestjs/config";
import { QueueModule } from "@bff/infra/queue/queue.module.js";
import { WhmcsCacheService } from "./cache/whmcs-cache.service.js";
import { WhmcsInvoiceService } from "./services/whmcs-invoice.service.js";
import { WhmcsSubscriptionService } from "./services/whmcs-subscription.service.js";
import { WhmcsClientService } from "./services/whmcs-client.service.js";
import { WhmcsPaymentService } from "./services/whmcs-payment.service.js";
import { WhmcsSsoService } from "./services/whmcs-sso.service.js";
import { WhmcsOrderService } from "./services/whmcs-order.service.js";
import { WhmcsCurrencyService } from "./services/whmcs-currency.service.js";
import { WhmcsAccountDiscoveryService } from "./services/whmcs-account-discovery.service.js";
// Connection services
import { WhmcsConnectionFacade } from "./facades/whmcs.facade.js";
import { WhmcsConfigService } from "./connection/config/whmcs-config.service.js";
import { WhmcsHttpClientService } from "./connection/services/whmcs-http-client.service.js";
import { WhmcsErrorHandlerService } from "./connection/services/whmcs-error-handler.service.js";

@Module({
  imports: [ConfigModule, QueueModule],
  providers: [
    // Connection facade (single path: facade → httpClient)
    WhmcsConnectionFacade,
    WhmcsConfigService,
    WhmcsHttpClientService,
    WhmcsErrorHandlerService,
    // Core services
    WhmcsCacheService,
    WhmcsInvoiceService,
    WhmcsSubscriptionService,
    WhmcsClientService,
    WhmcsPaymentService,
    WhmcsSsoService,
    WhmcsOrderService,
    WhmcsCurrencyService,
    WhmcsAccountDiscoveryService,
  ],
  exports: [
    WhmcsConnectionFacade,
    WhmcsCacheService,
    WhmcsClientService,
    WhmcsOrderService,
    WhmcsPaymentService,
    WhmcsInvoiceService,
    WhmcsSubscriptionService,
    WhmcsSsoService,
    WhmcsCurrencyService,
    WhmcsAccountDiscoveryService,
  ],
})
export class WhmcsModule {}
