// Copyright (c) 2020 UWB & LESP.
// The UWB & LESP license this file to you under the MIT license.

package cz.senslog.connector.model.converter;

public class FieldClimateUnitConverter {

    public static Long convertIdToSensLogId(String fcUnitId) {
        if (fcUnitId == null) return null;
        return Long.parseLong(fcUnitId, 16);
    }

    public static String convertIdToFieldClimateId(Long slUnitId) {
        if (slUnitId == null) return null;
        String hexVal = Long.toHexString(slUnitId);
        StringBuilder res = new StringBuilder();
        for (int i = hexVal.length(); i < 8; i++) {
            res.append("0");
        }
        res.append(hexVal);
        return res.toString();
    }
}
