Forward UI request UUID to broadcast channel request
[e-mobility-charging-stations-simulator.git] / src / ui / web / src / type / UIProtocol.ts
1 import { JsonObject } from './JsonType';
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
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
23 export enum ProcedureName {
24 LIST_CHARGING_STATIONS = 'listChargingStations',
25 START_CHARGING_STATION = 'startChargingStation',
26 STOP_CHARGING_STATION = 'stopChargingStation',
27 START_TRANSACTION = 'startTransaction',
28 STOP_TRANSACTION = 'stopTransaction',
29 START_SIMULATOR = 'startSimulator',
30 STOP_SIMULATOR = 'stopSimulator',
31 }
32 export interface RequestPayload extends JsonObject {
33 hashId?: string;
34 }
35
36 export enum ResponseStatus {
37 SUCCESS = 'success',
38 FAILURE = 'failure',
39 }
40
41 export interface ResponsePayload extends JsonObject {
42 status: ResponseStatus;
43 }