// Copyright © 2022-2026 Partium, Inc. DBA Partium import { IRequestedPart } from '../../models/request-list/request-list'; import { Observable } from 'rxjs'; import { EventContext } from '../../../core/models/log'; import { BaseService } from '../../../core/services/base.service'; import { LogService } from '../../../core/services/log.service'; import { ServiceProvider } from '../../../core/services/service-provider'; import { SearchService } from '../../../find'; interface RequestListEventContext extends EventContext { organizationId?: string; searchSessionId?: string; } /** * Service that provides functionality for creating and updating the request list. * It allows to add, remove and edit requested parts from the request list */ export interface RequestListService { /** * Updates the request list when new quantities are added to any of the request * list items is edited. * * @param requestedParts An array of type IRequestedPart of all the requested * parts in the list * @param updatedPart the part that is going to be added to the list * @param requestListEventContext (optional) RequestListEventContext object to add the missing data that will be logged using the log format V2 * @returns Observable with an array of the parts that resolves with the request * to the backend. */ updateRequestList(requestedParts: Array, updatedPart: IRequestedPart, requestListEventContext?: RequestListEventContext): Observable>; /** * Adds a new part to the request list. * * @param requestedParts An array of type IRequestedPart of all the requested * parts in the list * @param addedPart the part that is going to be added to the list * @param requestListEventContext (optional) RequestListEventContext object to add the missing data that will be logged using the log format V2 * @returns Observable with an array of the parts that resolves with the request * to the backend. */ addPart(requestedParts: Array, addedPart: IRequestedPart, requestListEventContext?: RequestListEventContext): Observable>; /** * Fetches the parts of the request list. * * @returns Observable with an array of the parts that resolves with the request * to the backend. */ getRequestList(): Observable>; /** * Resets the requests list to an empty array of parts. * @param requestListEventContext (optional) RequestListEventContext object to add the missing data that will be logged using the log format V2 * @returns Observable with an array of empty the parts that resolves with the * request to the backend. */ resetList(requestListEventContext?: RequestListEventContext): Observable>; /** * Deletes one part from the requestedList. * * @param partiumId the id of the part that is going to be removed * @param requestListEventContext (optional) RequestListEventContext object to add the missing data that will be logged using the log format V2 * @returns Observable with a boolean */ deletePart(partiumId: string, requestListEventContext?: RequestListEventContext): Observable; /** * Saves a group of parts in the requestList. * * @param updatedParts An array of type IRequestedPart of all the requested parts * that are going to be added to the list. * @param requestListEventContext (optional) RequestListEventContext object to add the missing data that will be logged using the log format V2 * @returns Observable with an array of the request list of the saved parts. */ saveRequestList(updatedParts: IRequestedPart[], requestListEventContext?: RequestListEventContext): Observable>; } export declare class RequestListServiceImpl extends BaseService implements RequestListService { private httpsService; protected logService: LogService; protected searchService: SearchService; constructor(serviceProvider: ServiceProvider); onCreate(): void; saveRequestList(updatedParts: IRequestedPart[], requestListEventContext: any): Observable>; updateRequestList(requestedParts: Array, updatedPart: IRequestedPart, requestListEventContext?: RequestListEventContext): Observable>; addPart(requestedParts: Array, addedPart: IRequestedPart, requestListEventContext?: RequestListEventContext): Observable>; getRequestList(): Observable>; /** * Resets the requests list to an empty array of parts. */ resetList(requestListEventContext?: RequestListEventContext): Observable>; /** * DELETE a part from request-list without send entire list to update */ deletePart(partiumId: string, requestListEventContext?: RequestListEventContext): Observable; /** * Post a requestList to the server to be stored in the cloud. */ private postRequestList; private dispatchLogService; } export {};