Fix build
[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 START_TRANSACTION = 'startTransaction',
14 STOP_TRANSACTION = 'stopTransaction',
15 OPEN_CONNECTION = 'openConnection',
16 CLOSE_CONNECTION = 'closeConnection',
17}
18
19interface BaseBroadcastChannelRequestPayload extends Omit<RequestPayload, 'hashId' | 'hashIds'> {
20 connectorId?: number;
21 transactionId?: number;
22 idTag?: string;
23}
24
25interface HashIdBroadcastChannelRequestPayload extends BaseBroadcastChannelRequestPayload {
26 hashId: string;
27}
28
29interface HashIdsBroadcastChannelRequestPayload extends BaseBroadcastChannelRequestPayload {
30 hashIds: string[];
31}
32
33export type BroadcastChannelRequestPayload =
34 | HashIdBroadcastChannelRequestPayload
35 | HashIdsBroadcastChannelRequestPayload;
36
37export interface BroadcastChannelResponsePayload extends ResponsePayload {
38 hashId: string;
39}
40
41export type MessageEvent = { data: BroadcastChannelRequest | BroadcastChannelResponse };