/** * Base Service Interface - Contract for all domain services * * @module @erp-suite/core/interfaces */ import { PaginatedResult, PaginationOptions } from '../types/pagination.types'; /** * Service context with tenant and user info */ export interface ServiceContext { tenantId: string; userId: string; } /** * Query options for service methods */ export interface QueryOptions { includeDeleted?: boolean; } /** * Base service interface for CRUD operations * * @template T - Entity type * @template CreateDto - DTO for create operations * @template UpdateDto - DTO for update operations */ export interface IBaseService { /** * Find all records with pagination */ findAll( ctx: ServiceContext, filters?: PaginationOptions & Record, options?: QueryOptions, ): Promise>; /** * Find record by ID */ findById( ctx: ServiceContext, id: string, options?: QueryOptions, ): Promise; /** * Create new record */ create(ctx: ServiceContext, data: CreateDto): Promise; /** * Update existing record */ update(ctx: ServiceContext, id: string, data: UpdateDto): Promise; /** * Soft delete record */ softDelete(ctx: ServiceContext, id: string): Promise; /** * Hard delete record */ hardDelete(ctx: ServiceContext, id: string): Promise; /** * Count records */ count( ctx: ServiceContext, filters?: Record, options?: QueryOptions, ): Promise; /** * Check if record exists */ exists(ctx: ServiceContext, id: string, options?: QueryOptions): Promise; }