refactor: refine type definitions
[e-mobility-charging-stations-simulator.git] / src / types / ocpp / Configuration.ts
index 6559f815a364048cb2b2c4f4c1ebf2adcd82c3b5..c174234812421c929e78f82bbbafdcceff45cdbe 100644 (file)
@@ -1,16 +1,35 @@
-import { OCPP16StandardParametersKey, OCPP16SupportedFeatureProfiles } from './1.6/Configuration';
-
-export type StandardParametersKey = OCPP16StandardParametersKey;
+import {
+  OCPP16StandardParametersKey,
+  OCPP16SupportedFeatureProfiles,
+  OCPP16VendorParametersKey
+} from './1.6/Configuration.js'
+import {
+  OCPP20OptionalVariableName,
+  OCPP20RequiredVariableName,
+  OCPP20VendorVariableName
+} from './2.0/Variables.js'
+import type { JsonObject } from '../JsonType.js'
 
 export const StandardParametersKey = {
-  ...OCPP16StandardParametersKey
-};
+  ...OCPP16StandardParametersKey,
+  ...OCPP20RequiredVariableName,
+  ...OCPP20OptionalVariableName
+} as const
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export type StandardParametersKey = OCPP16StandardParametersKey
 
-export type SupportedFeatureProfiles = OCPP16SupportedFeatureProfiles;
+export const VendorParametersKey = {
+  ...OCPP16VendorParametersKey,
+  ...OCPP20VendorVariableName
+} as const
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export type VendorParametersKey = OCPP16VendorParametersKey
 
 export const SupportedFeatureProfiles = {
   ...OCPP16SupportedFeatureProfiles
-};
+} as const
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export type SupportedFeatureProfiles = OCPP16SupportedFeatureProfiles
 
 export enum ConnectorPhaseRotation {
   NotApplicable = 'NotApplicable',
@@ -23,8 +42,10 @@ export enum ConnectorPhaseRotation {
   TSR = 'TSR'
 }
 
-export interface OCPPConfigurationKey {
-  key: string | StandardParametersKey;
-  readonly: boolean;
-  value?: string;
+export type ConfigurationKeyType = string | StandardParametersKey | VendorParametersKey
+
+export interface OCPPConfigurationKey extends JsonObject {
+  key: ConfigurationKeyType
+  readonly: boolean
+  value?: string
 }