/** * PartyShare Repository Interface * * Defines the contract for party share persistence. * Implementation will be in the infrastructure layer. */ import { PartyShare } from '../entities/party-share.entity'; import { ShareId, PartyId, SessionId, PublicKey } from '../value-objects'; import { PartyShareStatus, PartyShareType } from '../enums'; export interface PartyShareFilters { partyId?: string; status?: PartyShareStatus; shareType?: PartyShareType; publicKey?: string; } export interface Pagination { page: number; limit: number; } export interface PartyShareRepository { /** * Save a new party share */ save(share: PartyShare): Promise; /** * Update an existing party share */ update(share: PartyShare): Promise; /** * Find a share by its ID */ findById(id: ShareId): Promise; /** * Find a share by party ID and public key */ findByPartyIdAndPublicKey(partyId: PartyId, publicKey: PublicKey): Promise; /** * Find a share by party ID and session ID */ findByPartyIdAndSessionId(partyId: PartyId, sessionId: SessionId): Promise; /** * Find all shares for a given session */ findBySessionId(sessionId: SessionId): Promise; /** * Find all shares for a given party */ findByPartyId(partyId: PartyId): Promise; /** * Find all active shares for a given party */ findActiveByPartyId(partyId: PartyId): Promise; /** * Find share by public key */ findByPublicKey(publicKey: PublicKey): Promise; /** * Find shares with filters and pagination */ findMany(filters?: PartyShareFilters, pagination?: Pagination): Promise; /** * Count shares matching filters */ count(filters?: PartyShareFilters): Promise; /** * Check if a share exists for the given party and public key */ existsByPartyIdAndPublicKey(partyId: PartyId, publicKey: PublicKey): Promise; /** * Delete a share (soft delete - mark as revoked) */ delete(id: ShareId): Promise; } /** * Symbol for dependency injection */ export const PARTY_SHARE_REPOSITORY = Symbol('PARTY_SHARE_REPOSITORY');