package io.delphiplatform.api.v3.rdb.entity.converter;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

import io.delphiplatform.api.v3.model.ads.AdsDspSlug;

@Converter
public class AdsDspSlugAttributeConverter implements AttributeConverter<AdsDspSlug, String> {

    @Override
    public String convertToDatabaseColumn(AdsDspSlug attribute) {
        return attribute == null ? null : attribute.getValue();
    }

    @Override
    public AdsDspSlug convertToEntityAttribute(String dbData) {
        return AdsDspSlug.fromValue(dbData);
    }
}
