UI server: permit to address all charging stations
[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 }
20
21 interface BaseBroadcastChannelRequestPayload extends Omit<RequestPayload, 'hashId' | 'hashIds'> {
22 connectorId?: number;
23 connectorIds?: number[];
24 transactionId?: number;
25 idTag?: string;
26 }
27
28 interface HashIdsBroadcastChannelRequestPayload extends BaseBroadcastChannelRequestPayload {
29 hashIds: string[];
30 }
31
32 export type BroadcastChannelRequestPayload = HashIdsBroadcastChannelRequestPayload;
33
34 export interface BroadcastChannelResponsePayload extends ResponsePayload {
35 hashId: string;
36 }
37
38 export type MessageEvent = { data: BroadcastChannelRequest | BroadcastChannelResponse };