Move web ui code in its own directory
[e-mobility-charging-stations-simulator.git] / ui / web / src / types / UIProtocol.ts
CommitLineData
6c1761d4 1import type { 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 23export enum ProcedureName {
757b2ecf
JB
24 START_SIMULATOR = 'startSimulator',
25 STOP_SIMULATOR = 'stopSimulator',
32de5a57 26 LIST_CHARGING_STATIONS = 'listChargingStations',
4e3ff94d
JB
27 START_CHARGING_STATION = 'startChargingStation',
28 STOP_CHARGING_STATION = 'stopChargingStation',
ce7a4fc3
JB
29 OPEN_CONNECTION = 'openConnection',
30 CLOSE_CONNECTION = 'closeConnection',
757b2ecf
JB
31 START_AUTOMATIC_TRANSACTION_GENERATOR = 'startAutomaticTransactionGenerator',
32 STOP_AUTOMATIC_TRANSACTION_GENERATOR = 'stopAutomaticTransactionGenerator',
5e8e29f4
JB
33 START_TRANSACTION = 'startTransaction',
34 STOP_TRANSACTION = 'stopTransaction',
32de5a57 35}
a65319ba 36
4e3ff94d 37export interface RequestPayload extends JsonObject {
4eca248c 38 hashIds?: string[];
757b2ecf
JB
39 connectorId?: number;
40 connectorIds?: number[];
4e3ff94d 41}
32de5a57
LM
42
43export enum ResponseStatus {
44 SUCCESS = 'success',
45 FAILURE = 'failure',
46}
47
48export interface ResponsePayload extends JsonObject {
49 status: ResponseStatus;
fc040c43 50 hashIds?: string[];
32de5a57 51}