refactor(ui): add vue.js error handler
[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',
32de5a57 30 LIST_CHARGING_STATIONS = 'listChargingStations',
4e3ff94d
JB
31 START_CHARGING_STATION = 'startChargingStation',
32 STOP_CHARGING_STATION = 'stopChargingStation',
ce7a4fc3
JB
33 OPEN_CONNECTION = 'openConnection',
34 CLOSE_CONNECTION = 'closeConnection',
757b2ecf
JB
35 START_AUTOMATIC_TRANSACTION_GENERATOR = 'startAutomaticTransactionGenerator',
36 STOP_AUTOMATIC_TRANSACTION_GENERATOR = 'stopAutomaticTransactionGenerator',
5e8e29f4 37 START_TRANSACTION = 'startTransaction',
a974c8e4 38 STOP_TRANSACTION = 'stopTransaction'
32de5a57 39}
a65319ba 40
4e3ff94d 41export interface RequestPayload extends JsonObject {
66a7748d
JB
42 hashIds?: string[]
43 connectorIds?: number[]
4e3ff94d 44}
32de5a57
LM
45
46export enum ResponseStatus {
47 SUCCESS = 'success',
a974c8e4 48 FAILURE = 'failure'
32de5a57
LM
49}
50
51export interface ResponsePayload extends JsonObject {
66a7748d
JB
52 status: ResponseStatus
53 hashIds?: string[]
32de5a57 54}