X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=ui%2Fweb%2Fsrc%2Ftypes%2FUIProtocol.ts;h=8522aa11dcd8c4a10ac40a7e95ec94523bad1992;hb=HEAD;hp=6883cf8b1d9c0bb03dd3e931424847a8c472662d;hpb=329eab0e2561adc801877a95885f3ad15cbb90f6;p=e-mobility-charging-stations-simulator.git diff --git a/ui/web/src/types/UIProtocol.ts b/ui/web/src/types/UIProtocol.ts index 6883cf8b..8522aa11 100644 --- a/ui/web/src/types/UIProtocol.ts +++ b/ui/web/src/types/UIProtocol.ts @@ -17,17 +17,29 @@ export enum AuthenticationType { PROTOCOL_BASIC_AUTH = 'protocol-basic-auth' } -export type ProtocolRequest = [string, ProcedureName, RequestPayload] -export type ProtocolResponse = [string, ResponsePayload] +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 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', @@ -52,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 +}