Web UI: rename some directories to a sensible name
[e-mobility-charging-stations-simulator.git] / src / ui / web / src / types / UIProtocol.ts
... / ...
CommitLineData
1import type { JsonObject } from './JsonType';
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
16export type ProtocolRequest = [string, ProcedureName, RequestPayload];
17export type ProtocolResponse = [string, ResponsePayload];
18
19export type ProtocolRequestHandler = (
20 payload: RequestPayload
21) => ResponsePayload | Promise<ResponsePayload>;
22
23export 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 OPEN_CONNECTION = 'openConnection',
32 CLOSE_CONNECTION = 'closeConnection',
33}
34export interface RequestPayload extends JsonObject {
35 hashId?: string;
36 hashIds?: string[];
37}
38
39export enum ResponseStatus {
40 SUCCESS = 'success',
41 FAILURE = 'failure',
42}
43
44export interface ResponsePayload extends JsonObject {
45 status: ResponseStatus;
46}