import type { Provider } from '@nestjs/common';
import { HUB_SESSION_MANAGER } from '../../domain/ports';
import { JwtSignerAdapter } from '../strategies/local-provider/jwt-signer.adapter';

/**
 * Port-to-adapter binding for the hub session manager (intra-module DI, NOT a cross-BC bridge).
 *
 * `HUB_SESSION_MANAGER` is the token consumers `@Inject(...)` to obtain an `IHubSessionManager`
 * implementation. `JwtSignerAdapter` implements both `IJwtSigner` and `IHubSessionManager` using
 * the same RS256 key pair — `useExisting` reuses the singleton registered for `JwtSignerAdapter`.
 */
export const hubSessionManagerProvider: Provider = {
  provide: HUB_SESSION_MANAGER,
  useExisting: JwtSignerAdapter,
};
