refactor: add sanity checks at adding charging station(s)
[e-mobility-charging-stations-simulator.git] / ui / web / src / types / ChargingStationType.ts
index 8164bce83bddcc918aea9bab1beca4afee77fbdf..6814737e811106b70d9212e61cff24a9b007500a 100644 (file)
@@ -1,5 +1,29 @@
 import type { JsonObject } from './JsonType'
 
+export enum IdTagDistribution {
+  RANDOM = 'random',
+  ROUND_ROBIN = 'round-robin',
+  CONNECTOR_AFFINITY = 'connector-affinity'
+}
+
+export interface AutomaticTransactionGeneratorConfiguration {
+  enable: boolean
+  minDuration: number
+  maxDuration: number
+  minDelayBetweenTwoTransactions: number
+  maxDelayBetweenTwoTransactions: number
+  probabilityOfStart: number
+  stopAfterHours: number
+  stopAbsoluteDuration: boolean
+  requireAuthorize?: boolean
+  idTagDistribution?: IdTagDistribution
+}
+
+export interface ChargingStationAutomaticTransactionGeneratorConfiguration {
+  automaticTransactionGenerator?: AutomaticTransactionGeneratorConfiguration
+  automaticTransactionGeneratorStatuses?: Status[]
+}
+
 export type ChargingStationData = {
   started: boolean
   stationInfo: ChargingStationInfo
@@ -13,7 +37,7 @@ export type ChargingStationData = {
     | typeof WebSocket.CLOSING
     | typeof WebSocket.CLOSED
   bootNotificationResponse?: BootNotificationResponse
-  automaticTransactionGenerator?: Status[]
+  automaticTransactionGenerator?: ChargingStationAutomaticTransactionGeneratorConfiguration
 }
 
 export enum OCPP16FirmwareStatus {
@@ -40,11 +64,21 @@ export const FirmwareStatus = {
 } as const
 export type FirmwareStatus = OCPP16FirmwareStatus
 
+export interface ChargingStationOptions extends JsonObject {
+  supervisionUrls?: string | string[]
+  persistentConfiguration?: boolean
+  autoStart?: boolean
+  autoRegister?: boolean
+  enableStatistics?: boolean
+  ocppStrictCompliance?: boolean
+  stopTransactionsOnStopped?: boolean
+}
+
 export type ChargingStationInfo = {
   hashId: string
   templateIndex: number
   templateName: string
-  chargingStationId?: string
+  chargingStationId: string
   chargeBoxSerialNumber?: string
   chargePointSerialNumber?: string
   meterSerialNumber?: string
@@ -189,7 +223,8 @@ type CommandsSupport = {
 
 export enum OCPPVersion {
   VERSION_16 = '1.6',
-  VERSION_20 = '2.0'
+  VERSION_20 = '2.0',
+  VERSION_201 = '2.0.1'
 }
 
 export enum OCPPProtocol {