import type { PaginationParams, ServiceOptions } from '@shared/data/api/apiTypes' /** * Standard service interface for data operations * Defines the contract that all services should implement */ export interface IBaseService { /** * Find entity by ID */ findById(id: string, options?: ServiceOptions): Promise /** * Find multiple entities with pagination */ findMany( params: PaginationParams & Record, options?: ServiceOptions ): Promise<{ items: T[] total: number hasNext?: boolean nextCursor?: string }> /** * Create new entity */ create(data: TCreate, options?: ServiceOptions): Promise /** * Update existing entity */ update(id: string, data: TUpdate, options?: ServiceOptions): Promise /** * Delete entity (hard or soft delete depending on implementation) */ delete(id: string, options?: ServiceOptions): Promise /** * Check if entity exists */ exists(id: string, options?: ServiceOptions): Promise } /** * Extended service interface for soft delete operations */ export interface ISoftDeleteService extends IBaseService { /** * Archive entity (soft delete) */ archive(id: string, options?: ServiceOptions): Promise /** * Restore archived entity */ restore(id: string, options?: ServiceOptions): Promise } /** * Extended service interface for search operations */ export interface ISearchableService extends IBaseService { /** * Search entities by query */ search( query: string, params?: PaginationParams, options?: ServiceOptions ): Promise<{ items: T[] total: number hasNext?: boolean nextCursor?: string }> } /** * Service interface for hierarchical data (parent-child relationships) */ export interface IHierarchicalService extends IBaseService { /** * Get child entities for a parent */ getChildren( parentId: string, params?: PaginationParams, options?: ServiceOptions ): Promise<{ items: TChild[] total: number hasNext?: boolean nextCursor?: string }> /** * Add child entity to parent */ addChild(parentId: string, childData: TChildCreate, options?: ServiceOptions): Promise /** * Remove child entity from parent */ removeChild(parentId: string, childId: string, options?: ServiceOptions): Promise }