chore(deps-dev): apply updates
[e-mobility-charging-stations-simulator.git] / UIProtocol.ts
... / ...
CommitLineData
1import type { BroadcastChannelResponsePayload, JsonObject } from './internal';
2
3export enum Protocol {
4 UI = 'ui',
5}
6
7export enum ApplicationProtocol {
8 HTTP = 'http',
9 WS = 'ws',
10}
11
12export enum AuthenticationType {
13 BASIC_AUTH = 'basic-auth',
14}
15
16export enum ProtocolVersion {
17 '0.0.1' = '0.0.1',
18}
19
20export type ProtocolRequest = [string, ProcedureName, RequestPayload];
21export type ProtocolResponse = [string, ResponsePayload];
22
23export type ProtocolRequestHandler = (
24 uuid?: string,
25 procedureName?: ProcedureName,
26 payload?: RequestPayload
27) => undefined | Promise<undefined> | ResponsePayload | Promise<ResponsePayload>;
28
29export 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
51export interface RequestPayload extends JsonObject {
52 hashIds?: string[];
53 connectorIds?: number[];
54}
55
56export enum ResponseStatus {
57 SUCCESS = 'success',
58 FAILURE = 'failure',
59}
60
61export interface ResponsePayload extends JsonObject {
62 status: ResponseStatus;
63 hashIdsSucceeded?: string[];
64 hashIdsFailed?: string[];
65 responsesFailed?: BroadcastChannelResponsePayload[];
66}