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