import { Global, Module } from '@nestjs/common';
import { AuditWriter } from './audit.service';
import { HashUserIdService } from './hash-user-id.service';

/**
 * Provides the AuditWriter (and the salt-bound HashUserIdService it
 * depends on) to the rest of the BFF. Marked `@Global()` so a feature
 * module can inject `AuditWriter` by writing it in a constructor —
 * no need to re-import AuditModule in every feature. The append-only
 * contract is enforced by the Postgres role grants set up in the
 * audit-schema migration — see
 * apps/portal-bff/prisma/migrations/*_init_audit_schema.
 */
@Global()
@Module({
  providers: [HashUserIdService, AuditWriter],
  exports: [HashUserIdService, AuditWriter],
})
export class AuditModule {}
