refactor(simulator): explicitly export needed types only
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / 1.6 / OCPP16IncomingRequestService.ts
index e6b8cc979317eeeecd7e0112ad5b928fae8b9750..9424fcf2c697d6112e26c0c841ae53f092d332d0 100644 (file)
@@ -8,14 +8,17 @@ import type { JSONSchemaType } from 'ajv';
 import { Client, type FTPResponse } from 'basic-ftp';
 import tar from 'tar';
 
-import { OCPP16ServiceUtils } from './OCPP16ServiceUtils';
+import {
+  type ChargingStation,
+  ChargingStationConfigurationUtils,
+  ChargingStationUtils,
+} from '../../../charging-station';
 import { OCPPError } from '../../../exception';
 import {
   type ChangeAvailabilityRequest,
   type ChangeAvailabilityResponse,
   type ChangeConfigurationRequest,
   type ChangeConfigurationResponse,
-  ChargingProfilePurposeType,
   type ClearChargingProfileRequest,
   type ClearChargingProfileResponse,
   ErrorType,
@@ -36,6 +39,7 @@ import {
   OCPP16ChargePointErrorCode,
   OCPP16ChargePointStatus,
   type OCPP16ChargingProfile,
+  OCPP16ChargingProfilePurposeType,
   type OCPP16ClearCacheRequest,
   type OCPP16DataTransferRequest,
   type OCPP16DataTransferResponse,
@@ -73,14 +77,8 @@ import {
   type UnlockConnectorRequest,
   type UnlockConnectorResponse,
 } from '../../../types';
-import { Constants } from '../../../utils/Constants';
-import { logger } from '../../../utils/Logger';
-import { Utils } from '../../../utils/Utils';
-import type { ChargingStation } from '../../ChargingStation';
-import { ChargingStationConfigurationUtils } from '../../ChargingStationConfigurationUtils';
-import { ChargingStationUtils } from '../../ChargingStationUtils';
-import { OCPPConstants } from '../OCPPConstants';
-import { OCPPIncomingRequestService } from '../OCPPIncomingRequestService';
+import { Constants, Utils, logger } from '../../../utils';
+import { OCPP16ServiceUtils, OCPPConstants, OCPPIncomingRequestService } from '../internal';
 
 const moduleName = 'OCPP16IncomingRequestService';
 
@@ -539,14 +537,14 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     }
     if (
       commandPayload.csChargingProfiles.chargingProfilePurpose ===
-        ChargingProfilePurposeType.CHARGE_POINT_MAX_PROFILE &&
+        OCPP16ChargingProfilePurposeType.CHARGE_POINT_MAX_PROFILE &&
       commandPayload.connectorId !== 0
     ) {
       return OCPPConstants.OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED;
     }
     if (
       commandPayload.csChargingProfiles.chargingProfilePurpose ===
-        ChargingProfilePurposeType.TX_PROFILE &&
+        OCPP16ChargingProfilePurposeType.TX_PROFILE &&
       (commandPayload.connectorId === 0 ||
         chargingStation.getConnectorStatus(commandPayload.connectorId)?.transactionStarted ===
           false)
@@ -890,14 +888,14 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     connectorId: number,
     cp: OCPP16ChargingProfile
   ): boolean {
-    if (cp && cp.chargingProfilePurpose === ChargingProfilePurposeType.TX_PROFILE) {
+    if (cp && cp.chargingProfilePurpose === OCPP16ChargingProfilePurposeType.TX_PROFILE) {
       OCPP16ServiceUtils.setChargingProfile(chargingStation, connectorId, cp);
       logger.debug(
         `${chargingStation.logPrefix()} Charging profile(s) set at remote start transaction on connector id ${connectorId}: %j`,
         cp
       );
       return true;
-    } else if (cp && cp.chargingProfilePurpose !== ChargingProfilePurposeType.TX_PROFILE) {
+    } else if (cp && cp.chargingProfilePurpose !== OCPP16ChargingProfilePurposeType.TX_PROFILE) {
       logger.warn(
         `${chargingStation.logPrefix()} Not allowed to set ${
           cp.chargingProfilePurpose