feat(ui): use toggle button to star/stop simulator
[e-mobility-charging-stations-simulator.git] / src / types / UIProtocol.ts
CommitLineData
66a7748d
JB
1import type { JsonObject } from './JsonType.js'
2import type { BroadcastChannelResponsePayload } from './WorkerBroadcastChannel.js'
d1888640 3
4198ad5c 4export enum Protocol {
a223d9be 5 UI = 'ui'
4198ad5c 6}
8244f5f0 7
675fa8e3
JB
8export enum ApplicationProtocol {
9 HTTP = 'http',
a223d9be 10 WS = 'ws'
675fa8e3
JB
11}
12
eb3abc4f 13export enum AuthenticationType {
329eab0e
JB
14 BASIC_AUTH = 'basic-auth',
15 PROTOCOL_BASIC_AUTH = 'protocol-basic-auth'
eb3abc4f
JB
16}
17
8244f5f0 18export enum ProtocolVersion {
a223d9be 19 '0.0.1' = '0.0.1'
8244f5f0
JB
20}
21
66a7748d
JB
22export type ProtocolRequest = [string, ProcedureName, RequestPayload]
23export type ProtocolResponse = [string, ResponsePayload]
89b7a234
JB
24
25export type ProtocolRequestHandler = (
4e3ff94d 26 uuid?: string,
5e8e29f4 27 procedureName?: ProcedureName,
66a7748d
JB
28 payload?: RequestPayload
29) => undefined | Promise<undefined> | ResponsePayload | Promise<ResponsePayload>
89b7a234 30
32de5a57 31export enum ProcedureName {
240fa4da 32 SIMULATOR_STATE = 'simulatorState',
5e8e29f4
JB
33 START_SIMULATOR = 'startSimulator',
34 STOP_SIMULATOR = 'stopSimulator',
42e341c4 35 LIST_TEMPLATES = 'listTemplates',
ee0f106b 36 LIST_CHARGING_STATIONS = 'listChargingStations',
c5ecc04d 37 ADD_CHARGING_STATIONS = 'addChargingStations',
09e5a7a8 38 DELETE_CHARGING_STATIONS = 'deleteChargingStations',
a66bbcfe 39 PERFORMANCE_STATISTICS = 'performanceStatistics',
89b7a234
JB
40 START_CHARGING_STATION = 'startChargingStation',
41 STOP_CHARGING_STATION = 'stopChargingStation',
db2336d9
JB
42 OPEN_CONNECTION = 'openConnection',
43 CLOSE_CONNECTION = 'closeConnection',
4f69be04
JB
44 START_AUTOMATIC_TRANSACTION_GENERATOR = 'startAutomaticTransactionGenerator',
45 STOP_AUTOMATIC_TRANSACTION_GENERATOR = 'stopAutomaticTransactionGenerator',
269de583 46 SET_SUPERVISION_URL = 'setSupervisionUrl',
5e8e29f4
JB
47 START_TRANSACTION = 'startTransaction',
48 STOP_TRANSACTION = 'stopTransaction',
1984f194 49 AUTHORIZE = 'authorize',
8bfbc743 50 BOOT_NOTIFICATION = 'bootNotification',
a9ed42b2 51 STATUS_NOTIFICATION = 'statusNotification',
10db00b2 52 HEARTBEAT = 'heartbeat',
d3195f0a 53 METER_VALUES = 'meterValues',
91a7d3ea 54 DATA_TRANSFER = 'dataTransfer',
c9a4f9ea 55 DIAGNOSTICS_STATUS_NOTIFICATION = 'diagnosticsStatusNotification',
a223d9be 56 FIRMWARE_STATUS_NOTIFICATION = 'firmwareStatusNotification'
8244f5f0 57}
5612b691 58
89b7a234 59export interface RequestPayload extends JsonObject {
66a7748d
JB
60 hashIds?: string[]
61 connectorIds?: number[]
89b7a234 62}
8244f5f0 63
32de5a57
LM
64export enum ResponseStatus {
65 SUCCESS = 'success',
a223d9be 66 FAILURE = 'failure'
32de5a57
LM
67}
68
69export interface ResponsePayload extends JsonObject {
66a7748d
JB
70 status: ResponseStatus
71 hashIdsSucceeded?: string[]
72 hashIdsFailed?: string[]
73 responsesFailed?: BroadcastChannelResponsePayload[]
32de5a57 74}