+export const prepareChargingProfileKind = (
+ connectorStatus: ConnectorStatus,
+ chargingProfile: ChargingProfile,
+ currentDate: Date,
+ logPrefix: string,
+): boolean => {
+ switch (chargingProfile.chargingProfileKind) {
+ case ChargingProfileKindType.RECURRING:
+ if (!canProceedRecurringChargingProfile(chargingProfile, logPrefix)) {
+ return false;
+ }
+ prepareRecurringChargingProfile(chargingProfile, currentDate, logPrefix);
+ break;
+ case ChargingProfileKindType.RELATIVE:
+ if (!isNullOrUndefined(chargingProfile.chargingSchedule.startSchedule)) {
+ logger.warn(
+ `${logPrefix} ${moduleName}.prepareChargingProfileKind: Relative charging profile id ${chargingProfile.chargingProfileId} has a startSchedule property defined. It will be ignored or used if the connector has a transaction started`,
+ );
+ delete chargingProfile.chargingSchedule.startSchedule;
+ }
+ if (connectorStatus?.transactionStarted) {
+ chargingProfile.chargingSchedule.startSchedule = connectorStatus?.transactionStart;
+ }
+ // FIXME: Handle relative charging profile duration
+ break;
+ }
+ return true;
+};
+
+export const canProceedChargingProfile = (