UI Services: add status notification command
[e-mobility-charging-stations-simulator.git] / src / types / UIProtocol.ts
CommitLineData
6c1761d4 1import type { JsonObject } from './JsonType';
f53c88d0 2import type { BroadcastChannelResponsePayload } from './WorkerBroadcastChannel';
d1888640 3
4198ad5c
JB
4export enum Protocol {
5 UI = 'ui',
6}
8244f5f0 7
675fa8e3
JB
8export enum ApplicationProtocol {
9 HTTP = 'http',
10 WS = 'ws',
11}
12
eb3abc4f
JB
13export enum AuthenticationType {
14 BASIC_AUTH = 'basic-auth',
15}
16
8244f5f0
JB
17export enum ProtocolVersion {
18 '0.0.1' = '0.0.1',
8244f5f0
JB
19}
20
89b7a234
JB
21export type ProtocolRequest = [string, ProcedureName, RequestPayload];
22export type ProtocolResponse = [string, ResponsePayload];
23
24export type ProtocolRequestHandler = (
4e3ff94d
JB
25 uuid?: string,
26 payload?: RequestPayload
6c8f5d90 27) => undefined | Promise<undefined> | ResponsePayload | Promise<ResponsePayload>;
89b7a234 28
32de5a57 29export enum ProcedureName {
ee0f106b 30 LIST_CHARGING_STATIONS = 'listChargingStations',
89b7a234
JB
31 START_CHARGING_STATION = 'startChargingStation',
32 STOP_CHARGING_STATION = 'stopChargingStation',
32de5a57
LM
33 START_SIMULATOR = 'startSimulator',
34 STOP_SIMULATOR = 'stopSimulator',
db2336d9
JB
35 OPEN_CONNECTION = 'openConnection',
36 CLOSE_CONNECTION = 'closeConnection',
4f69be04
JB
37 START_TRANSACTION = 'startTransaction',
38 STOP_TRANSACTION = 'stopTransaction',
39 START_AUTOMATIC_TRANSACTION_GENERATOR = 'startAutomaticTransactionGenerator',
40 STOP_AUTOMATIC_TRANSACTION_GENERATOR = 'stopAutomaticTransactionGenerator',
a9ed42b2 41 STATUS_NOTIFICATION = 'statusNotification',
8244f5f0 42}
5612b691 43
89b7a234 44export interface RequestPayload extends JsonObject {
4eca248c 45 hashIds?: string[];
757b2ecf 46 connectorIds?: number[];
89b7a234 47}
8244f5f0 48
32de5a57
LM
49export enum ResponseStatus {
50 SUCCESS = 'success',
51 FAILURE = 'failure',
52}
53
54export interface ResponsePayload extends JsonObject {
55 status: ResponseStatus;
0d2cec76
JB
56 hashIdsSucceeded?: string[];
57 hashIdsFailed?: string[];
f53c88d0 58 responsesFailed?: BroadcastChannelResponsePayload[];
32de5a57 59}