import type { IConsent } from "../consent.interface";
import { InMemoryConsent } from "../in-memory-consent";

export type ConsentFactory = (userId: string) => Promise<IConsent>;

/**
 * Returns a ConsentFactory that creates InMemoryConsent instances.
 *
 * Used in dev-seed and storybook contexts where Payload is unavailable.
 * Each call to the factory produces a fresh, empty InMemoryConsent scoped
 * to the given userId (userId is ignored — state is not shared between
 * instances in dev mode, which is intentional for isolation).
 */
export function bindDevSeedConsent(): { consentFactory: ConsentFactory } {
  const factory: ConsentFactory = async (_userId) => {
    return new InMemoryConsent();
  };
  return { consentFactory: factory };
}
