/**
 * Salesforce Events Module
 *
 * Provides real-time event handling for Salesforce Platform Events and CDC.
 *
 * Platform Events (/event/ channels):
 * - AccountEventsSubscriber: Eligibility/verification status updates
 * - CaseEventsSubscriber: Support case status updates
 *
 * CDC - Change Data Capture (/data/ channels):
 * - CatalogCdcSubscriber: Product2/PricebookEntry changes
 * - OrderCdcSubscriber: Order/OrderItem changes
 *
 * Shared:
 * - PubSubClientService: Salesforce Pub/Sub API client management
 *
 * @see docs/integrations/salesforce/platform-events.md
 */

import { Module, forwardRef } from "@nestjs/common";
import { ConfigModule } from "@nestjs/config";
import { IntegrationsModule } from "@bff/integrations/integrations.module.js";
import { OrdersModule } from "@bff/modules/orders/orders.module.js";
import { ServicesModule } from "@bff/modules/services/services.module.js";
import { NotificationsModule } from "@bff/modules/notifications/notifications.module.js";
import { SupportModule } from "@bff/modules/support/support.module.js";
import { PubSubClientService } from "./shared/index.js";
import { AccountEventsSubscriber } from "./account-events.subscriber.js";
import { CaseEventsSubscriber } from "./case-events.subscriber.js";
import { CatalogCdcSubscriber } from "./catalog-cdc.subscriber.js";
import { OrderCdcSubscriber } from "./order-cdc.subscriber.js";

@Module({
  imports: [
    ConfigModule,
    forwardRef(() => IntegrationsModule),
    forwardRef(() => OrdersModule),
    forwardRef(() => ServicesModule),
    forwardRef(() => NotificationsModule),
    forwardRef(() => SupportModule),
  ],
  providers: [
    PubSubClientService,
    // Platform Events
    AccountEventsSubscriber,
    CaseEventsSubscriber,
    // CDC
    CatalogCdcSubscriber,
    OrderCdcSubscriber,
  ],
  exports: [PubSubClientService],
})
export class SalesforceEventsModule {}
