Vue UI + UI server
[e-mobility-charging-stations-simulator.git] / src / types / UIProtocol.ts
CommitLineData
32de5a57 1import { JsonObject, JsonType } from './JsonType';
d1888640 2
4198ad5c
JB
3export enum Protocol {
4 UI = 'ui',
5}
8244f5f0 6
675fa8e3
JB
7export enum ApplicationProtocol {
8 HTTP = 'http',
9 WS = 'ws',
10}
11
8244f5f0
JB
12export enum ProtocolVersion {
13 '0.0.1' = '0.0.1',
8244f5f0
JB
14}
15
32de5a57 16export enum ProcedureName {
ee0f106b 17 LIST_CHARGING_STATIONS = 'listChargingStations',
8244f5f0
JB
18 START_TRANSACTION = 'startTransaction',
19 STOP_TRANSACTION = 'stopTransaction',
32de5a57
LM
20 START_SIMULATOR = 'startSimulator',
21 STOP_SIMULATOR = 'stopSimulator',
8244f5f0
JB
22}
23
32de5a57
LM
24export enum ResponseStatus {
25 SUCCESS = 'success',
26 FAILURE = 'failure',
27}
28
29export interface ResponsePayload extends JsonObject {
30 status: ResponseStatus;
31}
32
33export type ProtocolRequest = [string, ProcedureName, JsonType];
34export type ProtocolResponse = [string, ResponsePayload];
8244f5f0 35
e7aeea18 36export type ProtocolRequestHandler = (
5cc4b63b 37 payload: JsonType
32de5a57 38) => void | Promise<void> | ResponsePayload | Promise<ResponsePayload>;