import { EventGroup, MessageOrigin, type OcppRequest, type OcppResponse, type CallAction, type OCPPVersionType } from '@citrineos/types'; import { OcppError } from '../../ocpp/rpc/message.js'; import type { IMessage } from '../messages/message.js'; import type { IMessageConfirmation } from '../messages/message-confirmation.js'; /** * Fields shared by the methods that build a new outbound message from scratch * ({@link IOcppSender.sendCall}, {@link IOcppSender.sendCallResult}, {@link IOcppSender.sendCallError}). * Methods that respond using an existing {@link IMessage} envelope already carry * these fields on `message` and don't take this type. */ export interface BaseOcppSenderArgs { ocppConnectionName: string; tenantId: number; protocol: OCPPVersionType; action: CallAction; eventGroup: EventGroup; origin?: MessageOrigin; } export interface SendCallArgs extends BaseOcppSenderArgs { payload: OcppRequest; callbackUrl?: string; correlationId?: string; } export interface SendCallResultArgs extends BaseOcppSenderArgs { payload: OcppResponse; correlationId: string; } export interface SendCallErrorArgs extends BaseOcppSenderArgs { payload: OcppError; correlationId: string; } export interface IOcppSender { sendCall(args: SendCallArgs): Promise; sendCallResult(args: SendCallResultArgs): Promise; sendCallResultWithMessage(message: IMessage, payload: OcppResponse): Promise; sendCallError(args: SendCallErrorArgs): Promise; sendCallErrorWithMessage(message: IMessage, payload: OcppError): Promise; }