]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/blame - src/types/UIProtocol.ts
chore(deps-dev): apply updates
[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
675fa8e3
JB
4export enum ApplicationProtocol {
5 HTTP = 'http',
271426fb 6 WS = 'ws',
675fa8e3
JB
7}
8
eb3abc4f 9export enum AuthenticationType {
329eab0e 10 BASIC_AUTH = 'basic-auth',
271426fb 11 PROTOCOL_BASIC_AUTH = 'protocol-basic-auth',
eb3abc4f
JB
12}
13
32de5a57 14export enum ProcedureName {
c5ecc04d 15 ADD_CHARGING_STATIONS = 'addChargingStations',
0749233f
JB
16 AUTHORIZE = 'authorize',
17 BOOT_NOTIFICATION = 'bootNotification',
18 CLOSE_CONNECTION = 'closeConnection',
19 DATA_TRANSFER = 'dataTransfer',
09e5a7a8 20 DELETE_CHARGING_STATIONS = 'deleteChargingStations',
0749233f
JB
21 DIAGNOSTICS_STATUS_NOTIFICATION = 'diagnosticsStatusNotification',
22 FIRMWARE_STATUS_NOTIFICATION = 'firmwareStatusNotification',
23 HEARTBEAT = 'heartbeat',
24 LIST_CHARGING_STATIONS = 'listChargingStations',
25 LIST_TEMPLATES = 'listTemplates',
26 METER_VALUES = 'meterValues',
db2336d9 27 OPEN_CONNECTION = 'openConnection',
0749233f 28 PERFORMANCE_STATISTICS = 'performanceStatistics',
269de583 29 SET_SUPERVISION_URL = 'setSupervisionUrl',
0749233f
JB
30 SIMULATOR_STATE = 'simulatorState',
31 START_AUTOMATIC_TRANSACTION_GENERATOR = 'startAutomaticTransactionGenerator',
32 START_CHARGING_STATION = 'startChargingStation',
33 START_SIMULATOR = 'startSimulator',
5e8e29f4 34 START_TRANSACTION = 'startTransaction',
a9ed42b2 35 STATUS_NOTIFICATION = 'statusNotification',
0749233f
JB
36 STOP_AUTOMATIC_TRANSACTION_GENERATOR = 'stopAutomaticTransactionGenerator',
37 STOP_CHARGING_STATION = 'stopChargingStation',
38 STOP_SIMULATOR = 'stopSimulator',
271426fb 39 STOP_TRANSACTION = 'stopTransaction',
8244f5f0 40}
5612b691 41
c4a89082
JB
42export enum Protocol {
43 UI = 'ui',
89b7a234 44}
8244f5f0 45
c4a89082
JB
46export enum ProtocolVersion {
47 '0.0.1' = '0.0.1',
48}
32de5a57 49export enum ResponseStatus {
0749233f 50 FAILURE = 'failure',
271426fb 51 SUCCESS = 'success',
32de5a57
LM
52}
53
c4a89082
JB
54export type ProtocolRequest = [
55 `${string}-${string}-${string}-${string}-${string}`,
56 ProcedureName,
57 RequestPayload
58]
59
60export type ProtocolRequestHandler = (
61 uuid?: `${string}-${string}-${string}-${string}-${string}`,
62 procedureName?: ProcedureName,
63 payload?: RequestPayload
64) => Promise<ResponsePayload> | Promise<undefined> | ResponsePayload | undefined
65
66export type ProtocolResponse = [
67 `${string}-${string}-${string}-${string}-${string}`,
68 ResponsePayload
69]
70
71export interface RequestPayload extends JsonObject {
72 connectorIds?: number[]
73 hashIds?: string[]
74}
75
32de5a57 76export interface ResponsePayload extends JsonObject {
66a7748d 77 hashIdsFailed?: string[]
0749233f 78 hashIdsSucceeded?: string[]
66a7748d 79 responsesFailed?: BroadcastChannelResponsePayload[]
0749233f 80 status: ResponseStatus
32de5a57 81}