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