/** * SessionState Repository Interface * * Defines the contract for session state persistence. */ import { SessionState } from '../entities/session-state.entity'; import { SessionId, PartyId } from '../value-objects'; import { SessionStatus, SessionType } from '../enums'; export interface SessionStateFilters { partyId?: string; status?: SessionStatus; sessionType?: SessionType; } export interface SessionStateRepository { /** * Save a new session state */ save(session: SessionState): Promise; /** * Update an existing session state */ update(session: SessionState): Promise; /** * Find a session state by ID */ findById(id: string): Promise; /** * Find a session state by session ID and party ID */ findBySessionIdAndPartyId(sessionId: SessionId, partyId: PartyId): Promise; /** * Find all session states for a given session */ findBySessionId(sessionId: SessionId): Promise; /** * Find all session states for a given party */ findByPartyId(partyId: PartyId): Promise; /** * Find all in-progress sessions for a party */ findInProgressByPartyId(partyId: PartyId): Promise; /** * Find sessions with filters */ findMany(filters?: SessionStateFilters): Promise; /** * Delete old completed sessions (cleanup) */ deleteCompletedBefore(date: Date): Promise; } /** * Symbol for dependency injection */ export const SESSION_STATE_REPOSITORY = Symbol('SESSION_STATE_REPOSITORY');