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 = ( | |
f3095697 | 20 | payload: RequestPayload, |
4e3ff94d JB |
21 | ) => ResponsePayload | Promise<ResponsePayload>; |
22 | ||
32de5a57 | 23 | export enum ProcedureName { |
757b2ecf JB |
24 | START_SIMULATOR = 'startSimulator', |
25 | STOP_SIMULATOR = 'stopSimulator', | |
32de5a57 | 26 | LIST_CHARGING_STATIONS = 'listChargingStations', |
4e3ff94d JB |
27 | START_CHARGING_STATION = 'startChargingStation', |
28 | STOP_CHARGING_STATION = 'stopChargingStation', | |
ce7a4fc3 JB |
29 | OPEN_CONNECTION = 'openConnection', |
30 | CLOSE_CONNECTION = 'closeConnection', | |
757b2ecf JB |
31 | START_AUTOMATIC_TRANSACTION_GENERATOR = 'startAutomaticTransactionGenerator', |
32 | STOP_AUTOMATIC_TRANSACTION_GENERATOR = 'stopAutomaticTransactionGenerator', | |
5e8e29f4 JB |
33 | START_TRANSACTION = 'startTransaction', |
34 | STOP_TRANSACTION = 'stopTransaction', | |
32de5a57 | 35 | } |
a65319ba | 36 | |
4e3ff94d | 37 | export interface RequestPayload extends JsonObject { |
4eca248c | 38 | hashIds?: string[]; |
757b2ecf | 39 | connectorIds?: number[]; |
4e3ff94d | 40 | } |
32de5a57 LM |
41 | |
42 | export enum ResponseStatus { | |
43 | SUCCESS = 'success', | |
44 | FAILURE = 'failure', | |
45 | } | |
46 | ||
47 | export interface ResponsePayload extends JsonObject { | |
48 | status: ResponseStatus; | |
fc040c43 | 49 | hashIds?: string[]; |
32de5a57 | 50 | } |