Fix Json type definition naming
[e-mobility-charging-stations-simulator.git] / src / types / UIProtocol.ts
index a7dfa334ef7f3fbb7c0e1b2ec03782c6a00a2538..4ff499b48cfbbd52a03c5507709752782271d346 100644 (file)
@@ -1,15 +1,22 @@
+import { JsonObject } from './JsonType';
+
+export enum Protocol {
+  UI = 'ui',
+}
 
 export enum ProtocolVersion {
   '0.0.1' = '0.0.1',
-  '0.0.2' = '0.0.2',
 }
 
 export enum ProtocolCommand {
+  LIST_CHARGING_STATIONS = 'listChargingStations',
   START_TRANSACTION = 'startTransaction',
   STOP_TRANSACTION = 'stopTransaction',
   UNKNOWN = 'unknown',
 }
 
-export type ProtocolRequest = [ProtocolVersion, ProtocolCommand, Record<string, unknown>];
+export type ProtocolRequest = [ProtocolCommand, JsonObject];
 
-export type ProtocolRequestHandler = (payload: Record<string, unknown>) => Record<string, unknown> | Promise<Record<string, unknown>>;
+export type ProtocolRequestHandler = (
+  payload: JsonObject
+) => void | Promise<void> | JsonObject | Promise<JsonObject>;