Commit | Line | Data |
---|---|---|
6c1761d4 | 1 | import type { JsonObject } from './JsonType'; |
32de5a57 LM |
2 | |
3 | export enum Protocol { | |
4 | UI = 'ui', | |
5 | } | |
6 | ||
7 | export enum ApplicationProtocol { | |
8 | HTTP = 'http', | |
9 | WS = 'ws', | |
10 | } | |
11 | ||
12 | export enum ProtocolVersion { | |
13 | '0.0.1' = '0.0.1', | |
14 | } | |
15 | ||
4e3ff94d JB |
16 | export type ProtocolRequest = [string, ProcedureName, RequestPayload]; |
17 | export type ProtocolResponse = [string, ResponsePayload]; | |
18 | ||
19 | export type ProtocolRequestHandler = ( | |
20 | payload: RequestPayload | |
21 | ) => ResponsePayload | Promise<ResponsePayload>; | |
22 | ||
32de5a57 LM |
23 | export enum ProcedureName { |
24 | LIST_CHARGING_STATIONS = 'listChargingStations', | |
4e3ff94d JB |
25 | START_CHARGING_STATION = 'startChargingStation', |
26 | STOP_CHARGING_STATION = 'stopChargingStation', | |
32de5a57 LM |
27 | START_TRANSACTION = 'startTransaction', |
28 | STOP_TRANSACTION = 'stopTransaction', | |
29 | START_SIMULATOR = 'startSimulator', | |
30 | STOP_SIMULATOR = 'stopSimulator', | |
ce7a4fc3 JB |
31 | OPEN_CONNECTION = 'openConnection', |
32 | CLOSE_CONNECTION = 'closeConnection', | |
32de5a57 | 33 | } |
4e3ff94d JB |
34 | export interface RequestPayload extends JsonObject { |
35 | hashId?: string; | |
4eca248c | 36 | hashIds?: string[]; |
4e3ff94d | 37 | } |
32de5a57 LM |
38 | |
39 | export enum ResponseStatus { | |
40 | SUCCESS = 'success', | |
41 | FAILURE = 'failure', | |
42 | } | |
43 | ||
44 | export interface ResponsePayload extends JsonObject { | |
45 | status: ResponseStatus; | |
fc040c43 | 46 | hashIds?: string[]; |
32de5a57 | 47 | } |