import type { DomainError } from "../errors/generic-domain-error.js"; import type { ObservationStore } from "../../domain/ports/observation-store.port.js"; import { Ok, type Result, type Observation } from "@tff/core"; import type { Candidate } from "../../shared/value-objects/candidate.js"; import type { Pattern } from "../../shared/value-objects/pattern.js"; export class InMemoryObservationStore implements ObservationStore { private observations: Observation[] = []; private patterns: Pattern[] = []; private candidates: Candidate[] = []; async appendObservation(obs: Observation): Promise> { this.observations.push(obs); return Ok(undefined); } async readObservations(): Promise> { return Ok([...this.observations]); } async writePatterns(patterns: Pattern[]): Promise> { this.patterns = patterns; return Ok(undefined); } async readPatterns(): Promise> { return Ok([...this.patterns]); } async writeCandidates(candidates: Candidate[]): Promise> { this.candidates = candidates; return Ok(undefined); } async readCandidates(): Promise> { return Ok([...this.candidates]); } reset(): void { this.observations = []; this.patterns = []; this.candidates = []; } }