package com.l7tech.util;

import jakarta.persistence.AttributeConverter;
import java.math.BigInteger;
import org.jetbrains.annotations.Nullable;

public class BigIntegerBase64AttributeConverter implements AttributeConverter<BigInteger, String> {
   @Nullable
   public String convertToDatabaseColumn(@Nullable BigInteger var1) {
      return var1 == null ? null : HexUtils.encodeBase64(var1.toByteArray(), true);
   }

   @Nullable
   public BigInteger convertToEntityAttribute(@Nullable String var1) {
      return var1 != null && !var1.isEmpty() ? new BigInteger(HexUtils.decodeBase64(var1)) : null;
   }
}
