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