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