// Local type aliases mirroring exports from `@repo/core-dsr`.
// Kept inline to avoid a build-graph cycle between core-testing (tooling)
// and core-dsr (optional core). Same pattern used by RecordingAuditLog,
// RecordingConsent, and other recording doubles.

/** Recorded call to updateSubjectField. */
export type RecordedRectifyCall = {
  subjectId: string;
  collection: string;
  field: string;
  value: unknown;
};

/**
 * Test-side recording double for IDataRectify. Records all updateSubjectField
 * calls for assertion while making no persistent changes.
 *
 * Use directly via constructor injection:
 *   const rectifier = new RecordingDataRectify();
 *   const uc = myUseCase(rectifier);
 *   await uc({ ... });
 *   expect(rectifier.calls[0]?.field).toBe("name");
 */
export class RecordingDataRectify {
  public calls: RecordedRectifyCall[] = [];

  async updateSubjectField(
    subjectId: string,
    collection: string,
    field: string,
    value: unknown,
  ): Promise<void> {
    this.calls.push({ subjectId, collection, field, value });
  }

  reset(): void {
    this.calls = [];
  }
}
