import { Logger, Module } from "@nestjs/common";
import { CancellationController } from "./cancellation.controller.js";
import { CancellationService } from "./cancellation.service.js";
import { SubscriptionsOrchestrator } from "../subscriptions-orchestrator.service.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 { InternetManagementModule } from "../internet-management/internet-management.module.js";
import { SimManagementModule } from "../sim-management/sim-management.module.js";
import { SharedSubscriptionsModule } from "../shared/index.js";

/**
 * Unified Cancellation Module
 *
 * Provides a single endpoint for cancelling any service type.
 * Delegates to InternetCancellationService or SimCancellationService based on
 * service type detected from subscription product name.
 */
@Module({
  imports: [
    WhmcsModule,
    SalesforceModule,
    MappingsModule,
    InternetManagementModule,
    SimManagementModule,
    SharedSubscriptionsModule,
  ],
  controllers: [CancellationController],
  providers: [CancellationService, SubscriptionsOrchestrator, Logger],
  exports: [CancellationService],
})
export class CancellationModule {}
