refactor: rename configuration elementStartDelay to elementAddDelay
[e-mobility-charging-stations-simulator.git] / src / types / ConfigurationData.ts
CommitLineData
66a7748d
JB
1import type { ListenOptions } from 'node:net'
2import type { ResourceLimits } from 'node:worker_threads'
8114d10e 3
66a7748d 4import type { WorkerChoiceStrategy } from 'poolifier'
8114d10e 5
4c3f6c20 6import type { WorkerProcessType } from '../worker/index.js'
66a7748d
JB
7import type { StorageType } from './Storage.js'
8import type { ApplicationProtocol, AuthenticationType } from './UIProtocol.js'
a4624c96 9
66a7748d 10type ServerOptions = ListenOptions
66271092 11
5d049829
JB
12export enum ConfigurationSection {
13 log = 'log',
14 performanceStorage = 'performanceStorage',
15 worker = 'worker',
a223d9be 16 uiServer = 'uiServer'
5d049829
JB
17}
18
2dcfe98e
JB
19export enum SupervisionUrlDistribution {
20 ROUND_ROBIN = 'round-robin',
21 RANDOM = 'random',
a223d9be 22 CHARGING_STATION_AFFINITY = 'charging-station-affinity'
2dcfe98e
JB
23}
24
e1d9a0f4 25export interface StationTemplateUrl {
66a7748d
JB
26 file: string
27 numberOfStations: number
e1d9a0f4 28}
e118beaa 29
e1d9a0f4 30export interface LogConfiguration {
66a7748d
JB
31 enabled?: boolean
32 file?: string
33 errorFile?: string
34 statisticsInterval?: number
35 level?: string
36 console?: boolean
37 format?: string
38 rotate?: boolean
39 maxFiles?: string | number
40 maxSize?: string | number
e1d9a0f4 41}
3d48c1c1 42
a6080904
JB
43export enum ApplicationProtocolVersion {
44 VERSION_11 = 1.1,
a223d9be 45 VERSION_20 = 2.0
a6080904
JB
46}
47
e1d9a0f4 48export interface UIServerConfiguration {
66a7748d
JB
49 enabled?: boolean
50 type?: ApplicationProtocol
51 version?: ApplicationProtocolVersion
52 options?: ServerOptions
eb3abc4f 53 authentication?: {
66a7748d
JB
54 enabled: boolean
55 type: AuthenticationType
56 username?: string
57 password?: string
58 }
e1d9a0f4 59}
6a49ad23 60
e1d9a0f4 61export interface StorageConfiguration {
66a7748d
JB
62 enabled?: boolean
63 type?: StorageType
64 uri?: string
e1d9a0f4 65}
72f041bd 66
66a7748d 67export type ElementsPerWorkerType = number | 'auto' | 'all'
47fb5f8f 68
e1d9a0f4 69export interface WorkerConfiguration {
66a7748d
JB
70 processType?: WorkerProcessType
71 startDelay?: number
72 elementsPerWorker?: ElementsPerWorkerType
da47bc29 73 /** @deprecated Use `elementAddDelay` instead. */
66a7748d 74 elementStartDelay?: number
da47bc29 75 elementAddDelay?: number
66a7748d
JB
76 poolMinSize?: number
77 poolMaxSize?: number
78 resourceLimits?: ResourceLimits
e1d9a0f4 79}
cf2a5d9b 80
e1d9a0f4 81export interface ConfigurationData {
66a7748d
JB
82 supervisionUrls?: string | string[]
83 supervisionUrlDistribution?: SupervisionUrlDistribution
84 stationTemplateUrls: StationTemplateUrl[]
85 log?: LogConfiguration
86 worker?: WorkerConfiguration
87 uiServer?: UIServerConfiguration
88 performanceStorage?: StorageConfiguration
da47bc29 89 /** @deprecated Moved to charging station template. */
66a7748d 90 autoReconnectMaxRetries?: number
edd13439 91 /** @deprecated Moved to worker configuration section. */
66a7748d 92 workerProcess?: WorkerProcessType
edd13439 93 /** @deprecated Moved to worker configuration section. */
66a7748d 94 workerStartDelay?: number
edd13439 95 /** @deprecated Moved to worker configuration section. */
da47bc29 96 elementAddDelay?: number
edd13439 97 /** @deprecated Moved to worker configuration section. */
66a7748d 98 workerPoolMinSize?: number
edd13439 99 /** @deprecated Moved to worker configuration section. */
66a7748d 100 workerPoolMaxSize?: number
edd13439 101 /** @deprecated Moved to worker configuration section. */
66a7748d 102 workerPoolStrategy?: WorkerChoiceStrategy
edd13439 103 /** @deprecated Moved to worker configuration section. */
66a7748d 104 chargingStationsPerWorker?: number
3d48c1c1 105 /** @deprecated Moved to log configuration section. */
66a7748d 106 logStatisticsInterval?: number
3d48c1c1 107 /** @deprecated Moved to log configuration section. */
66a7748d 108 logEnabled?: boolean
3d48c1c1 109 /** @deprecated Moved to log configuration section. */
66a7748d 110 logConsole?: boolean
3d48c1c1 111 /** @deprecated Moved to log configuration section. */
66a7748d 112 logFormat?: string
3d48c1c1 113 /** @deprecated Moved to log configuration section. */
66a7748d 114 logLevel?: string
3d48c1c1 115 /** @deprecated Moved to log configuration section. */
66a7748d 116 logRotate?: boolean
3d48c1c1 117 /** @deprecated Moved to log configuration section. */
66a7748d 118 logMaxFiles?: number | string
3d48c1c1 119 /** @deprecated Moved to log configuration section. */
66a7748d 120 logMaxSize?: number | string
3d48c1c1 121 /** @deprecated Moved to log configuration section. */
66a7748d 122 logFile?: string
3d48c1c1 123 /** @deprecated Moved to log configuration section. */
66a7748d 124 logErrorFile?: string
e1d9a0f4 125}