Forward UI request UUID to broadcast channel request
[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',
31}
4e3ff94d
JB
32export interface RequestPayload extends JsonObject {
33 hashId?: string;
34}
32de5a57
LM
35
36export enum ResponseStatus {
37 SUCCESS = 'success',
38 FAILURE = 'failure',
39}
40
41export interface ResponsePayload extends JsonObject {
42 status: ResponseStatus;
43}