import type { BaseEntity } from './types'; import { BaseRemoteDataServices } from './base-remote.data-services'; /** * General-purpose remote data services. * * A concrete, non-abstract version of BaseRemoteDataServices that * can be instantiated directly for standard CRUD modules that don't * need additional custom methods. * * For modules requiring domain-specific operations beyond standard * CRUD + lifecycle, extend BaseRemoteDataServices instead and add * custom methods using `this.execute()` or `this.customRequest()`. * * @typeParam E - The domain entity type * @typeParam TDTO - The API DTO shape (defaults to E for backward compatibility) * * @example * ```ts * // Direct instantiation for standard modules (no transformer) * const bookingServices = new CommonRemoteDataServices( * apiClient, * { apiUrl: '/bookings', moduleKey: 'BOOKING' }, * ); * * const { data } = await bookingServices.getMany(); * ``` * * @example * ```ts * // With transformer for DTO ↔ Entity mapping * const bookingServices = new CommonRemoteDataServices( * apiClient, * { * apiUrl: '/bookings', * moduleKey: 'BOOKING', * transformer: new BookingTransformer(), * }, * ); * ``` * * @example * ```ts * // For modules needing custom operations, extend the base: * class InvoiceDataServices extends BaseRemoteDataServices { * async calculateTax(invoiceId: string) { * return this.customRequest({ * url: `/invoices/${invoiceId}/calculate-tax`, * method: 'POST', * }); * } * } * ``` */ export class CommonRemoteDataServices extends BaseRemoteDataServices< E, TDTO > {}