Commit | Line | Data |
---|---|---|
66a7748d | 1 | import type { JsonObject } from './JsonType' |
32de5a57 LM |
2 | |
3 | export enum Protocol { | |
a974c8e4 | 4 | UI = 'ui' |
32de5a57 LM |
5 | } |
6 | ||
7 | export enum ApplicationProtocol { | |
8 | HTTP = 'http', | |
a974c8e4 | 9 | WS = 'ws' |
32de5a57 LM |
10 | } |
11 | ||
12 | export enum ProtocolVersion { | |
a974c8e4 | 13 | '0.0.1' = '0.0.1' |
32de5a57 LM |
14 | } |
15 | ||
66a7748d JB |
16 | export type ProtocolRequest = [string, ProcedureName, RequestPayload] |
17 | export type ProtocolResponse = [string, ResponsePayload] | |
4e3ff94d JB |
18 | |
19 | export type ProtocolRequestHandler = ( | |
66a7748d JB |
20 | payload: RequestPayload |
21 | ) => ResponsePayload | Promise<ResponsePayload> | |
4e3ff94d | 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 | 33 | START_TRANSACTION = 'startTransaction', |
a974c8e4 | 34 | STOP_TRANSACTION = 'stopTransaction' |
32de5a57 | 35 | } |
a65319ba | 36 | |
4e3ff94d | 37 | export interface RequestPayload extends JsonObject { |
66a7748d JB |
38 | hashIds?: string[] |
39 | connectorIds?: number[] | |
4e3ff94d | 40 | } |
32de5a57 LM |
41 | |
42 | export enum ResponseStatus { | |
43 | SUCCESS = 'success', | |
a974c8e4 | 44 | FAILURE = 'failure' |
32de5a57 LM |
45 | } |
46 | ||
47 | export interface ResponsePayload extends JsonObject { | |
66a7748d JB |
48 | status: ResponseStatus |
49 | hashIds?: string[] | |
32de5a57 | 50 | } |