package com.ffii.fpsms.modules.master.enums

import jakarta.persistence.AttributeConverter
import jakarta.persistence.Converter

@Converter(autoApply = true)
class ShopTypeConverter : AttributeConverter<ShopType, String> {
    override fun convertToDatabaseColumn(type: ShopType?): String? {
        return type?.value
    }

    override fun convertToEntityAttribute(value: String?): ShopType? {
        return value?.let { v ->
            ShopType.entries.find { it.value == v }
        }
    }
}