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