| 1 | import type { JsonObject } from './JsonType' |
| 2 | |
| 3 | export enum Protocol { |
| 4 | UI = 'ui' |
| 5 | } |
| 6 | |
| 7 | export enum ApplicationProtocol { |
| 8 | WS = 'ws', |
| 9 | WSS = 'wss' |
| 10 | } |
| 11 | |
| 12 | export enum ProtocolVersion { |
| 13 | '0.0.1' = '0.0.1' |
| 14 | } |
| 15 | |
| 16 | export enum AuthenticationType { |
| 17 | PROTOCOL_BASIC_AUTH = 'protocol-basic-auth' |
| 18 | } |
| 19 | |
| 20 | export type ProtocolRequest = [string, ProcedureName, RequestPayload] |
| 21 | export type ProtocolResponse = [string, ResponsePayload] |
| 22 | |
| 23 | export type ProtocolRequestHandler = ( |
| 24 | payload: RequestPayload |
| 25 | ) => ResponsePayload | Promise<ResponsePayload> |
| 26 | |
| 27 | export enum ProcedureName { |
| 28 | START_SIMULATOR = 'startSimulator', |
| 29 | STOP_SIMULATOR = 'stopSimulator', |
| 30 | LIST_TEMPLATES = 'listTemplates', |
| 31 | LIST_CHARGING_STATIONS = 'listChargingStations', |
| 32 | ADD_CHARGING_STATIONS = 'addChargingStations', |
| 33 | DELETE_CHARGING_STATIONS = 'deleteChargingStations', |
| 34 | SET_SUPERVISION_URL = 'setSupervisionUrl', |
| 35 | START_CHARGING_STATION = 'startChargingStation', |
| 36 | STOP_CHARGING_STATION = 'stopChargingStation', |
| 37 | OPEN_CONNECTION = 'openConnection', |
| 38 | CLOSE_CONNECTION = 'closeConnection', |
| 39 | START_AUTOMATIC_TRANSACTION_GENERATOR = 'startAutomaticTransactionGenerator', |
| 40 | STOP_AUTOMATIC_TRANSACTION_GENERATOR = 'stopAutomaticTransactionGenerator', |
| 41 | START_TRANSACTION = 'startTransaction', |
| 42 | STOP_TRANSACTION = 'stopTransaction' |
| 43 | } |
| 44 | |
| 45 | export interface RequestPayload extends JsonObject { |
| 46 | hashIds?: string[] |
| 47 | connectorIds?: number[] |
| 48 | } |
| 49 | |
| 50 | export enum ResponseStatus { |
| 51 | SUCCESS = 'success', |
| 52 | FAILURE = 'failure' |
| 53 | } |
| 54 | |
| 55 | export interface ResponsePayload extends JsonObject { |
| 56 | status: ResponseStatus |
| 57 | hashIds?: string[] |
| 58 | } |