| 1 | import type { Status } from './AutomaticTransactionGenerator'; |
| 2 | import type ChargingStationInfo from './ChargingStationInfo'; |
| 3 | import type { ConnectorStatus } from './ConnectorStatus'; |
| 4 | import type { JsonObject } from './JsonType'; |
| 5 | import type { BootNotificationResponse } from './ocpp/Responses'; |
| 6 | import type Statistics from './Statistics'; |
| 7 | import { WorkerData, WorkerMessage, WorkerMessageEvents } from './Worker'; |
| 8 | |
| 9 | export interface ChargingStationWorkerOptions extends JsonObject { |
| 10 | elementStartDelay?: number; |
| 11 | } |
| 12 | |
| 13 | export interface ChargingStationWorkerData extends WorkerData { |
| 14 | index: number; |
| 15 | templateFile: string; |
| 16 | chargingStationWorkerOptions?: ChargingStationWorkerOptions; |
| 17 | } |
| 18 | |
| 19 | export interface ChargingStationData extends WorkerData { |
| 20 | stationInfo: ChargingStationInfo; |
| 21 | started: boolean; |
| 22 | wsState?: number; |
| 23 | bootNotificationResponse: BootNotificationResponse; |
| 24 | connectors: ConnectorStatus[]; |
| 25 | automaticTransactionGeneratorStatuses?: Status[]; |
| 26 | } |
| 27 | |
| 28 | enum ChargingStationMessageEvents { |
| 29 | STARTED = 'started', |
| 30 | STOPPED = 'stopped', |
| 31 | UPDATED = 'updated', |
| 32 | PERFORMANCE_STATISTICS = 'performanceStatistics', |
| 33 | } |
| 34 | |
| 35 | export type ChargingStationWorkerMessageEvents = WorkerMessageEvents | ChargingStationMessageEvents; |
| 36 | |
| 37 | export const ChargingStationWorkerMessageEvents = { |
| 38 | ...WorkerMessageEvents, |
| 39 | ...ChargingStationMessageEvents, |
| 40 | }; |
| 41 | |
| 42 | export type ChargingStationWorkerMessageData = ChargingStationData | Statistics; |
| 43 | |
| 44 | export interface ChargingStationWorkerMessage<T extends WorkerData> |
| 45 | extends Omit<WorkerMessage<T>, 'id'> { |
| 46 | id: ChargingStationWorkerMessageEvents; |
| 47 | } |