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

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

import io.delphiplatform.api.v3.model.video.VideoDspSlug;

@Converter
public class VideoDspSlugAttributeConverter implements AttributeConverter<VideoDspSlug, String> {

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

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