Fix meterStop type in stop transaction payload
[e-mobility-charging-stations-simulator.git] / src / types / WorkerBroadcastChannel.ts
... / ...
CommitLineData
1import type { RequestPayload, ResponsePayload } from './UIProtocol';
2
3export type BroadcastChannelRequest = [
4 string,
5 BroadcastChannelProcedureName,
6 BroadcastChannelRequestPayload
7];
8export type BroadcastChannelResponse = [string, BroadcastChannelResponsePayload];
9
10export 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
21interface BaseBroadcastChannelRequestPayload extends Omit<RequestPayload, 'hashId' | 'hashIds'> {
22 connectorId?: number;
23 transactionId?: number;
24 idTag?: string;
25}
26
27interface HashIdBroadcastChannelRequestPayload extends BaseBroadcastChannelRequestPayload {
28 hashId: string;
29}
30
31interface HashIdsBroadcastChannelRequestPayload extends BaseBroadcastChannelRequestPayload {
32 hashIds: string[];
33}
34
35export type BroadcastChannelRequestPayload =
36 | HashIdBroadcastChannelRequestPayload
37 | HashIdsBroadcastChannelRequestPayload;
38
39export interface BroadcastChannelResponsePayload extends ResponsePayload {
40 hashId: string;
41}
42
43export type MessageEvent = { data: BroadcastChannelRequest | BroadcastChannelResponse };