import { CardTypeEnum } from './value-objects/CardType'; export interface CardQueryOptions { page: number; limit: number; sortBy: CardSortField; sortOrder: SortOrder; } export interface PaginatedQueryResult { items: T[]; totalCount: number; hasMore: boolean; } export enum CardSortField { CREATED_AT = 'createdAt', UPDATED_AT = 'updatedAt', LIBRARY_COUNT = 'libraryCount', } export enum SortOrder { ASC = 'asc', DESC = 'desc', } // Simplified DTO for cards in a collection (no collections array to avoid circular data) export interface UrlCardView { id: string; type: CardTypeEnum.URL; url: string; cardContent: { url: string; title?: string; description?: string; author?: string; thumbnailUrl?: string; }; libraryCount: number; createdAt: Date; updatedAt: Date; note?: { id: string; text: string; }; } export type CollectionCardQueryResultDTO = UrlCardView; // Raw data from repository - minimal, just what's stored export interface WithCollections { collections: { id: string; name: string; authorId: string }[]; } export interface WithLibraries { libraries: { userId: string }[]; } export type UrlCardQueryResultDTO = UrlCardView & WithCollections; // DTO for single URL card view with library and collection info export type UrlCardViewDTO = UrlCardView & WithCollections & WithLibraries; export interface LibraryForUrlDTO { userId: string; cardId: string; } export interface NoteCardForUrlDTO { id: string; note: string; authorId: string; createdAt: Date; updatedAt: Date; } export interface ICardQueryRepository { getUrlCardsOfUser( userId: string, options: CardQueryOptions, ): Promise>; getCardsInCollection( collectionId: string, options: CardQueryOptions, ): Promise>; getUrlCardView(cardId: string): Promise; getLibrariesForCard(cardId: string): Promise; getLibrariesForUrl( url: string, options: CardQueryOptions, ): Promise>; getNoteCardsForUrl( url: string, options: CardQueryOptions, ): Promise>; }