import { randomUUID } from "node:crypto";
import type { IDataDelete } from "./data-delete.interface";
import type { DeletionMode, DeletionCertificate } from "./dsr-types";

/**
 * Volatile in-memory IDataDelete. Returns a well-shaped DeletionCertificate
 * without touching any persistence layer.
 *
 * Used in dev-seed and storybook contexts where Payload is unavailable.
 * Not a recording double — use RecordingDataDelete from @repo/core-testing for
 * call-assertion in unit tests.
 */
export class InMemoryDataDelete implements IDataDelete {
  async deleteSubjectData(
    subjectId: string,
    mode: DeletionMode,
  ): Promise<DeletionCertificate> {
    return {
      subjectId,
      mode,
      timestamp: new Date().toISOString(),
      reason: "art-17-request",
      affected: [],
      auditEntryId: randomUUID(),
    };
  }
}
