refactor: cleanup default params in error handlers
[e-mobility-charging-stations-simulator.git] / ui / web / src / types / UIProtocol.ts
index 07eb52125599520cf59e8e81b4675d39bca85383..8522aa11dcd8c4a10ac40a7e95ec94523bad1992 100644 (file)
@@ -5,25 +5,41 @@ export enum Protocol {
 }
 
 export enum ApplicationProtocol {
-  HTTP = 'http',
-  WS = 'ws'
+  WS = 'ws',
+  WSS = 'wss'
 }
 
 export enum ProtocolVersion {
   '0.0.1' = '0.0.1'
 }
 
-export type ProtocolRequest = [string, ProcedureName, RequestPayload]
-export type ProtocolResponse = [string, ResponsePayload]
+export enum AuthenticationType {
+  PROTOCOL_BASIC_AUTH = 'protocol-basic-auth'
+}
+
+export type ProtocolRequest = [
+  `${string}-${string}-${string}-${string}-${string}`,
+  ProcedureName,
+  RequestPayload
+]
+export type ProtocolResponse = [
+  `${string}-${string}-${string}-${string}-${string}`,
+  ResponsePayload
+]
 
 export type ProtocolRequestHandler = (
   payload: RequestPayload
 ) => ResponsePayload | Promise<ResponsePayload>
 
 export enum ProcedureName {
+  SIMULATOR_STATE = 'simulatorState',
   START_SIMULATOR = 'startSimulator',
   STOP_SIMULATOR = 'stopSimulator',
+  LIST_TEMPLATES = 'listTemplates',
   LIST_CHARGING_STATIONS = 'listChargingStations',
+  ADD_CHARGING_STATIONS = 'addChargingStations',
+  DELETE_CHARGING_STATIONS = 'deleteChargingStations',
+  SET_SUPERVISION_URL = 'setSupervisionUrl',
   START_CHARGING_STATION = 'startChargingStation',
   STOP_CHARGING_STATION = 'stopChargingStation',
   OPEN_CONNECTION = 'openConnection',
@@ -48,3 +64,16 @@ export interface ResponsePayload extends JsonObject {
   status: ResponseStatus
   hashIds?: string[]
 }
+
+interface TemplateStatistics extends JsonObject {
+  configured: number
+  added: number
+  started: number
+  indexes: number[]
+}
+
+export interface SimulatorState extends JsonObject {
+  version: string
+  started: boolean
+  templateStatistics: Record<string, TemplateStatistics>
+}