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