/** * In-Memory DecisionCase Repository * * Adapter: Implements DecisionCaseRepository using a Map. * Purpose: Testing, development, CI/CD pipelines. * NOT for production. */ import { DecisionCase, DecisionCaseId, ArtifactId, EvidenceId, } from '@landvex/domain'; import { DecisionCaseRepository } from '../repositories/repository-interfaces'; export class InMemoryDecisionCaseRepository implements DecisionCaseRepository { private cases = new Map(); async save(decisionCase: DecisionCase): Promise { this.cases.set(decisionCase.id, decisionCase); } async findById(id: DecisionCaseId): Promise { return this.cases.get(id) ?? null; } async findByArtifact(artifactId: ArtifactId): Promise { return Array.from(this.cases.values()) .filter(c => c.evidenceIds.includes(artifactId as any)); } async findByStatus( status: 'pending' | 'under_review' | 'approved' | 'rejected' ): Promise { return Array.from(this.cases.values()) .filter(c => c.status === status); } clear(): void { this.cases.clear(); } count(): number { return this.cases.size; } }