UI protocol: Allow to send some relevant commands to several charging… (#152)
[e-mobility-charging-stations-simulator.git] / src / ui / web / src / type / UIProtocol.ts
CommitLineData
4e3ff94d 1import { JsonObject } from './JsonType';
32de5a57
LM
2
3export enum Protocol {
4 UI = 'ui',
5}
6
7export enum ApplicationProtocol {
8 HTTP = 'http',
9 WS = 'ws',
10}
11
12export enum ProtocolVersion {
13 '0.0.1' = '0.0.1',
14}
15
4e3ff94d
JB
16export type ProtocolRequest = [string, ProcedureName, RequestPayload];
17export type ProtocolResponse = [string, ResponsePayload];
18
19export type ProtocolRequestHandler = (
20 payload: RequestPayload
21) => ResponsePayload | Promise<ResponsePayload>;
22
32de5a57
LM
23export 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
34export interface RequestPayload extends JsonObject {
35 hashId?: string;
4eca248c 36 hashIds?: string[];
4e3ff94d 37}
32de5a57
LM
38
39export enum ResponseStatus {
40 SUCCESS = 'success',
41 FAILURE = 'failure',
42}
43
44export interface ResponsePayload extends JsonObject {
45 status: ResponseStatus;
46}