UI Protocol: Expose ATG status and use array for all list
[e-mobility-charging-stations-simulator.git] / src / ui / web / src / types / UIProtocol.ts
1 import type { ChargingStationData } from './ChargingStationType';
2 import type { JsonObject } from './JsonType';
3
4 export enum Protocol {
5 UI = 'ui',
6 }
7
8 export enum ApplicationProtocol {
9 HTTP = 'http',
10 WS = 'ws',
11 }
12
13 export enum ProtocolVersion {
14 '0.0.1' = '0.0.1',
15 }
16
17 export type ProtocolRequest = [string, ProcedureName, RequestPayload];
18 export type ProtocolResponse = [string, ResponsePayload];
19
20 export type ProtocolRequestHandler = (
21 payload: RequestPayload
22 ) => ResponsePayload | Promise<ResponsePayload>;
23
24 export enum ProcedureName {
25 START_SIMULATOR = 'startSimulator',
26 STOP_SIMULATOR = 'stopSimulator',
27 LIST_CHARGING_STATIONS = 'listChargingStations',
28 START_CHARGING_STATION = 'startChargingStation',
29 STOP_CHARGING_STATION = 'stopChargingStation',
30 OPEN_CONNECTION = 'openConnection',
31 CLOSE_CONNECTION = 'closeConnection',
32 START_TRANSACTION = 'startTransaction',
33 STOP_TRANSACTION = 'stopTransaction',
34 START_AUTOMATIC_TRANSACTION_GENERATOR = 'startAutomaticTransactionGenerator',
35 STOP_AUTOMATIC_TRANSACTION_GENERATOR = 'stopAutomaticTransactionGenerator',
36 }
37 export interface RequestPayload extends JsonObject {
38 hashIds?: string[];
39 connectorId?: number;
40 connectorIds?: number[];
41 }
42
43 export enum ResponseStatus {
44 SUCCESS = 'success',
45 FAILURE = 'failure',
46 }
47
48 export interface ResponsePayload extends JsonObject {
49 status: ResponseStatus;
50 hashIds?: string[];
51 }