class FirmwareManagementService extends AbstractService {

    boolean checkSsldPendingFirmwareUpdate(final CorrelationIds ids, final List<FirmwareVersion> firmwareVersions) {

        final String deviceIdentification = ids.getDeviceIdentification();

        final SsldPendingFirmwareUpdate ssldPendingFirmwareUpdate = this.ssldPendingFirmwareUpdateRepository
                .findByDeviceIdentification(deviceIdentification)
                .stream()
                .filter(pendingUpdate -> pendingUpdate.getCorrelationUid().equals(ids.getCorrelationUid()))
                .findAny()
                .orElse(null);
        if (ssldPendingFirmwareUpdate == null) {
            return false;
        }

        LOGGER.info("Found SSLD pending firmware update record for device identification: {}, {}.",
                deviceIdentification, ssldPendingFirmwareUpdate);

        final FirmwareModuleType expectedFirmwareModuleType = ssldPendingFirmwareUpdate.getFirmwareModuleType();
        final String expectedFirmwareVersion = ssldPendingFirmwareUpdate.getFirmwareVersion();
        final boolean foundExpectedFirmwareVersion = firmwareVersions.stream()
                .anyMatch(fv -> expectedFirmwareModuleType.equals(fv.getFirmwareModuleType())
                        && expectedFirmwareVersion.equals(fv.getVersion()));

        if (foundExpectedFirmwareVersion) {
            LOGGER.info(
                    "Expected firmware version from SSLD pending firmware update record matches firmware version as retrieved from device identification: {}, firmware version: {}, firmware module type: {}.",
                    deviceIdentification, expectedFirmwareVersion, expectedFirmwareModuleType);
        } else {
            LOGGER.error(
                    "Expected firmware version from SSLD pending firmware update record does )not match firmware version as retrieved from device identification: {}, expected firmware version: {}, expected firmware module type: {}, actual firmware version and module type list: {}",
                    deviceIdentification, expectedFirmwareVersion, expectedFirmwareModuleType, firmwareVersions);
        }

        this.ssldPendingFirmwareUpdateRepository.delete(ssldPendingFirmwareUpdate);
        return true;
    }

    public  FirmwareManagementService();

}