fix: fix ATG refresh at template changes
[e-mobility-charging-stations-simulator.git] / src / types / UIProtocol.ts
CommitLineData
2896e06d 1import type { BroadcastChannelResponsePayload, JsonObject } from './internal';
d1888640 2
4198ad5c
JB
3export enum Protocol {
4 UI = 'ui',
5}
8244f5f0 6
675fa8e3
JB
7export enum ApplicationProtocol {
8 HTTP = 'http',
9 WS = 'ws',
10}
11
eb3abc4f
JB
12export enum AuthenticationType {
13 BASIC_AUTH = 'basic-auth',
14}
15
8244f5f0
JB
16export enum ProtocolVersion {
17 '0.0.1' = '0.0.1',
8244f5f0
JB
18}
19
89b7a234
JB
20export type ProtocolRequest = [string, ProcedureName, RequestPayload];
21export type ProtocolResponse = [string, ResponsePayload];
22
23export type ProtocolRequestHandler = (
4e3ff94d 24 uuid?: string,
5e8e29f4 25 procedureName?: ProcedureName,
4e3ff94d 26 payload?: RequestPayload
6c8f5d90 27) => undefined | Promise<undefined> | ResponsePayload | Promise<ResponsePayload>;
89b7a234 28
32de5a57 29export enum ProcedureName {
5e8e29f4
JB
30 START_SIMULATOR = 'startSimulator',
31 STOP_SIMULATOR = 'stopSimulator',
ee0f106b 32 LIST_CHARGING_STATIONS = 'listChargingStations',
89b7a234
JB
33 START_CHARGING_STATION = 'startChargingStation',
34 STOP_CHARGING_STATION = 'stopChargingStation',
db2336d9
JB
35 OPEN_CONNECTION = 'openConnection',
36 CLOSE_CONNECTION = 'closeConnection',
4f69be04
JB
37 START_AUTOMATIC_TRANSACTION_GENERATOR = 'startAutomaticTransactionGenerator',
38 STOP_AUTOMATIC_TRANSACTION_GENERATOR = 'stopAutomaticTransactionGenerator',
269de583 39 SET_SUPERVISION_URL = 'setSupervisionUrl',
5e8e29f4
JB
40 START_TRANSACTION = 'startTransaction',
41 STOP_TRANSACTION = 'stopTransaction',
1984f194 42 AUTHORIZE = 'authorize',
8bfbc743 43 BOOT_NOTIFICATION = 'bootNotification',
a9ed42b2 44 STATUS_NOTIFICATION = 'statusNotification',
10db00b2 45 HEARTBEAT = 'heartbeat',
d3195f0a 46 METER_VALUES = 'meterValues',
91a7d3ea 47 DATA_TRANSFER = 'dataTransfer',
c9a4f9ea
JB
48 DIAGNOSTICS_STATUS_NOTIFICATION = 'diagnosticsStatusNotification',
49 FIRMWARE_STATUS_NOTIFICATION = 'firmwareStatusNotification',
8244f5f0 50}
5612b691 51
89b7a234 52export interface RequestPayload extends JsonObject {
4eca248c 53 hashIds?: string[];
757b2ecf 54 connectorIds?: number[];
89b7a234 55}
8244f5f0 56
32de5a57
LM
57export enum ResponseStatus {
58 SUCCESS = 'success',
59 FAILURE = 'failure',
60}
61
62export interface ResponsePayload extends JsonObject {
63 status: ResponseStatus;
0d2cec76
JB
64 hashIdsSucceeded?: string[];
65 hashIdsFailed?: string[];
f53c88d0 66 responsesFailed?: BroadcastChannelResponsePayload[];
32de5a57 67}