refactor(ui): cleanup vue.js app initialization code and logic
[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 {
a974c8e4 4 UI = 'ui'
32de5a57
LM
5}
6
7export enum ApplicationProtocol {
217db058
JB
8 WS = 'ws',
9 WSS = 'wss'
32de5a57
LM
10}
11
12export enum ProtocolVersion {
a974c8e4 13 '0.0.1' = '0.0.1'
32de5a57
LM
14}
15
217db058 16export enum AuthenticationType {
329eab0e 17 PROTOCOL_BASIC_AUTH = 'protocol-basic-auth'
217db058
JB
18}
19
66a7748d
JB
20export type ProtocolRequest = [string, ProcedureName, RequestPayload]
21export type ProtocolResponse = [string, ResponsePayload]
4e3ff94d
JB
22
23export type ProtocolRequestHandler = (
66a7748d
JB
24 payload: RequestPayload
25) => ResponsePayload | Promise<ResponsePayload>
4e3ff94d 26
32de5a57 27export enum ProcedureName {
757b2ecf
JB
28 START_SIMULATOR = 'startSimulator',
29 STOP_SIMULATOR = 'stopSimulator',
a64b9a64 30 DELETE_CHARGING_STATIONS = 'deleteChargingStations',
32de5a57 31 LIST_CHARGING_STATIONS = 'listChargingStations',
4e3ff94d
JB
32 START_CHARGING_STATION = 'startChargingStation',
33 STOP_CHARGING_STATION = 'stopChargingStation',
ce7a4fc3
JB
34 OPEN_CONNECTION = 'openConnection',
35 CLOSE_CONNECTION = 'closeConnection',
757b2ecf
JB
36 START_AUTOMATIC_TRANSACTION_GENERATOR = 'startAutomaticTransactionGenerator',
37 STOP_AUTOMATIC_TRANSACTION_GENERATOR = 'stopAutomaticTransactionGenerator',
5e8e29f4 38 START_TRANSACTION = 'startTransaction',
a974c8e4 39 STOP_TRANSACTION = 'stopTransaction'
32de5a57 40}
a65319ba 41
4e3ff94d 42export interface RequestPayload extends JsonObject {
66a7748d
JB
43 hashIds?: string[]
44 connectorIds?: number[]
4e3ff94d 45}
32de5a57
LM
46
47export enum ResponseStatus {
48 SUCCESS = 'success',
a974c8e4 49 FAILURE = 'failure'
32de5a57
LM
50}
51
52export interface ResponsePayload extends JsonObject {
66a7748d
JB
53 status: ResponseStatus
54 hashIds?: string[]
32de5a57 55}