import { Module } from '@nestjs/common';
import { MediaModule } from '../media/media.module';
import { CapabilityProviderRegistry } from './capability.registry';
import { CapabilityBroker } from './capability.broker';
import { ProviderCredentialService } from './provider-credential.service';
import { ProviderCredentialController } from './provider-credential.controller';

/**
 * The governed egress boundary (P9 slice 1). Exports the broker + registry so the
 * outbound layer routes all sends through policy + obligations + a pluggable
 * provider. PLATFORM_PORTS (for the opa gate) comes from the @Global PlatformModule.
 * Also owns per-scope BYO provider credentials (Twilio SMS, …) — sealed at rest and
 * resolved by the channel providers at send time.
 */
@Module({
  imports: [MediaModule],
  controllers: [ProviderCredentialController],
  providers: [CapabilityProviderRegistry, CapabilityBroker, ProviderCredentialService],
  exports: [CapabilityBroker, CapabilityProviderRegistry, ProviderCredentialService],
})
export class CapabilityModule {}
