UI Protocol: add Authorize command support
[e-mobility-charging-stations-simulator.git] / src / types / WorkerBroadcastChannel.ts
1 import type { RequestPayload, ResponsePayload } from './UIProtocol';
2
3 export type BroadcastChannelRequest = [
4 string,
5 BroadcastChannelProcedureName,
6 BroadcastChannelRequestPayload
7 ];
8 export type BroadcastChannelResponse = [string, BroadcastChannelResponsePayload];
9
10 export enum BroadcastChannelProcedureName {
11 START_CHARGING_STATION = 'startChargingStation',
12 STOP_CHARGING_STATION = 'stopChargingStation',
13 OPEN_CONNECTION = 'openConnection',
14 CLOSE_CONNECTION = 'closeConnection',
15 START_TRANSACTION = 'startTransaction',
16 STOP_TRANSACTION = 'stopTransaction',
17 START_AUTOMATIC_TRANSACTION_GENERATOR = 'startAutomaticTransactionGenerator',
18 STOP_AUTOMATIC_TRANSACTION_GENERATOR = 'stopAutomaticTransactionGenerator',
19 AUTHORIZE = 'authorize',
20 STATUS_NOTIFICATION = 'statusNotification',
21 HEARTBEAT = 'heartbeat',
22 }
23
24 export interface BroadcastChannelRequestPayload extends RequestPayload {
25 connectorId?: number;
26 transactionId?: number;
27 idTag?: string;
28 }
29
30 export interface BroadcastChannelResponsePayload
31 extends Omit<ResponsePayload, 'hashIdsSucceeded' | 'hashIdsFailed' | 'responsesFailed'> {
32 hashId: string;
33 }
34
35 export type MessageEvent = { data: BroadcastChannelRequest | BroadcastChannelResponse };