refactor: more coding style fixes
[e-mobility-charging-stations-simulator.git] / ui / web / src / types / UIProtocol.ts
CommitLineData
66a7748d 1import type { JsonObject } from './JsonType'
32de5a57
LM
2
3export enum Protocol {
a807045b 4 UI = 'ui',
32de5a57
LM
5}
6
7export enum ApplicationProtocol {
8 HTTP = 'http',
a807045b 9 WS = 'ws',
32de5a57
LM
10}
11
12export enum ProtocolVersion {
a807045b 13 '0.0.1' = '0.0.1',
32de5a57
LM
14}
15
66a7748d
JB
16export type ProtocolRequest = [string, ProcedureName, RequestPayload]
17export type ProtocolResponse = [string, ResponsePayload]
4e3ff94d
JB
18
19export type ProtocolRequestHandler = (
66a7748d
JB
20 payload: RequestPayload
21) => ResponsePayload | Promise<ResponsePayload>
4e3ff94d 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 33 START_TRANSACTION = 'startTransaction',
a807045b 34 STOP_TRANSACTION = 'stopTransaction',
32de5a57 35}
a65319ba 36
4e3ff94d 37export interface RequestPayload extends JsonObject {
66a7748d
JB
38 hashIds?: string[]
39 connectorIds?: number[]
4e3ff94d 40}
32de5a57
LM
41
42export enum ResponseStatus {
43 SUCCESS = 'success',
a807045b 44 FAILURE = 'failure',
32de5a57
LM
45}
46
47export interface ResponsePayload extends JsonObject {
66a7748d
JB
48 status: ResponseStatus
49 hashIds?: string[]
32de5a57 50}