build: switch to NodeNext module resolution
[e-mobility-charging-stations-simulator.git] / src / types / ConfigurationData.ts
CommitLineData
3f85aa2b 1import type { ListenOptions } from 'node:net';
487f0dfd 2import type { ResourceLimits } from 'node:worker_threads';
8114d10e 3
9efbac5b 4import type { WorkerChoiceStrategy } from 'poolifier';
8114d10e 5
a6ef1ece
JB
6import type { StorageType } from './Storage.js';
7import type { ApplicationProtocol, AuthenticationType } from './UIProtocol.js';
8import type { WorkerProcessType } from '../worker/index.js';
a4624c96 9
0ac97927 10type ServerOptions = ListenOptions;
66271092 11
5d049829
JB
12export enum ConfigurationSection {
13 log = 'log',
14 performanceStorage = 'performanceStorage',
15 worker = 'worker',
16 uiServer = 'uiServer',
17}
18
2dcfe98e
JB
19export enum SupervisionUrlDistribution {
20 ROUND_ROBIN = 'round-robin',
21 RANDOM = 'random',
c72f6634 22 CHARGING_STATION_AFFINITY = 'charging-station-affinity',
2dcfe98e
JB
23}
24
e1d9a0f4 25export interface StationTemplateUrl {
e118beaa
JB
26 file: string;
27 numberOfStations: number;
e1d9a0f4 28}
e118beaa 29
e1d9a0f4 30export interface LogConfiguration {
3d48c1c1
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,
45 VERSION_20 = 2.0,
46}
47
e1d9a0f4 48export interface UIServerConfiguration {
6a49ad23 49 enabled?: boolean;
1f7fa4de 50 type?: ApplicationProtocol;
a6080904 51 version?: ApplicationProtocolVersion;
66271092 52 options?: ServerOptions;
eb3abc4f
JB
53 authentication?: {
54 enabled: boolean;
55 type: AuthenticationType;
56 username?: string;
57 password?: string;
58 };
e1d9a0f4 59}
6a49ad23 60
e1d9a0f4 61export interface StorageConfiguration {
72f041bd
JB
62 enabled?: boolean;
63 type?: StorageType;
1f5df42a 64 uri?: string;
e1d9a0f4 65}
72f041bd 66
65a1157a 67export type ElementsPerWorkerType = number | 'auto' | 'all';
47fb5f8f 68
e1d9a0f4 69export interface WorkerConfiguration {
cf2a5d9b
JB
70 processType?: WorkerProcessType;
71 startDelay?: number;
65a1157a 72 elementsPerWorker?: ElementsPerWorkerType;
cf2a5d9b
JB
73 elementStartDelay?: number;
74 poolMinSize?: number;
75 poolMaxSize?: number;
487f0dfd 76 resourceLimits?: ResourceLimits;
e1d9a0f4 77}
cf2a5d9b 78
e1d9a0f4 79export interface ConfigurationData {
2dcfe98e
JB
80 supervisionUrls?: string | string[];
81 supervisionUrlDistribution?: SupervisionUrlDistribution;
1f5df42a 82 stationTemplateUrls: StationTemplateUrl[];
3d48c1c1
JB
83 log?: LogConfiguration;
84 worker?: WorkerConfiguration;
675fa8e3 85 uiServer?: UIServerConfiguration;
72f041bd 86 performanceStorage?: StorageConfiguration;
b8efd65b 87 /** @deprecated Moved to charging station template */
e118beaa 88 autoReconnectMaxRetries?: number;
edd13439 89 /** @deprecated Moved to worker configuration section. */
a4624c96 90 workerProcess?: WorkerProcessType;
edd13439 91 /** @deprecated Moved to worker configuration section. */
322c9192 92 workerStartDelay?: number;
edd13439 93 /** @deprecated Moved to worker configuration section. */
4bfd80fa 94 elementStartDelay?: number;
edd13439 95 /** @deprecated Moved to worker configuration section. */
a4624c96 96 workerPoolMinSize?: number;
edd13439 97 /** @deprecated Moved to worker configuration section. */
4fa59b8a 98 workerPoolMaxSize?: number;
edd13439 99 /** @deprecated Moved to worker configuration section. */
9efbac5b 100 workerPoolStrategy?: WorkerChoiceStrategy;
edd13439 101 /** @deprecated Moved to worker configuration section. */
5fdab605 102 chargingStationsPerWorker?: number;
3d48c1c1 103 /** @deprecated Moved to log configuration section. */
72f041bd 104 logStatisticsInterval?: number;
3d48c1c1 105 /** @deprecated Moved to log configuration section. */
ae389044 106 logEnabled?: boolean;
3d48c1c1 107 /** @deprecated Moved to log configuration section. */
ae389044 108 logConsole?: boolean;
3d48c1c1 109 /** @deprecated Moved to log configuration section. */
e118beaa 110 logFormat?: string;
3d48c1c1 111 /** @deprecated Moved to log configuration section. */
324fd4ee 112 logLevel?: string;
3d48c1c1 113 /** @deprecated Moved to log configuration section. */
6bf6769e 114 logRotate?: boolean;
3d48c1c1 115 /** @deprecated Moved to log configuration section. */
9988696d 116 logMaxFiles?: number | string;
3d48c1c1 117 /** @deprecated Moved to log configuration section. */
9988696d 118 logMaxSize?: number | string;
3d48c1c1 119 /** @deprecated Moved to log configuration section. */
e118beaa 120 logFile?: string;
3d48c1c1 121 /** @deprecated Moved to log configuration section. */
7ec46a9a 122 logErrorFile?: string;
e1d9a0f4 123}