Refine TS and linter configuration
[e-mobility-charging-stations-simulator.git] / src / types / ConfigurationData.ts
1 import type { ListenOptions } from 'net';
2
3 import type { WorkerChoiceStrategy } from 'poolifier';
4 import type { ServerOptions as WSServerOptions } from 'ws';
5
6 import type { StorageType } from './Storage';
7 import type { ApplicationProtocol } from './UIProtocol';
8 import type { WorkerProcessType } from './Worker';
9
10 export type ServerOptions = WSServerOptions & ListenOptions;
11
12 export enum SupervisionUrlDistribution {
13 ROUND_ROBIN = 'round-robin',
14 RANDOM = 'random',
15 SEQUENTIAL = 'sequential',
16 }
17
18 export interface StationTemplateUrl {
19 file: string;
20 numberOfStations: number;
21 }
22
23 export interface UIServerConfiguration {
24 enabled?: boolean;
25 type?: ApplicationProtocol;
26 options?: ServerOptions;
27 }
28
29 export interface StorageConfiguration {
30 enabled?: boolean;
31 type?: StorageType;
32 uri?: string;
33 }
34
35 export interface WorkerConfiguration {
36 processType?: WorkerProcessType;
37 startDelay?: number;
38 elementsPerWorker?: number;
39 elementStartDelay?: number;
40 poolMinSize?: number;
41 poolMaxSize?: number;
42 poolStrategy?: WorkerChoiceStrategy;
43 }
44
45 export default interface ConfigurationData {
46 supervisionUrls?: string | string[];
47 supervisionUrlDistribution?: SupervisionUrlDistribution;
48 stationTemplateUrls: StationTemplateUrl[];
49 uiServer?: UIServerConfiguration;
50 performanceStorage?: StorageConfiguration;
51 worker?: WorkerConfiguration;
52 autoReconnectMaxRetries?: number;
53 // deprecated
54 workerProcess?: WorkerProcessType;
55 // deprecated
56 workerStartDelay?: number;
57 // deprecated
58 elementStartDelay?: number;
59 // deprecated
60 workerPoolMinSize?: number;
61 // deprecated
62 workerPoolMaxSize?: number;
63 // deprecated
64 workerPoolStrategy?: WorkerChoiceStrategy;
65 // deprecated
66 chargingStationsPerWorker?: number;
67 logStatisticsInterval?: number;
68 logFormat?: string;
69 logLevel?: string;
70 logRotate?: boolean;
71 logMaxFiles?: number;
72 logFile?: string;
73 logErrorFile?: string;
74 logConsole?: boolean;
75 }