package com.ffii.fpsms.modules.stock.entity.enum

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

@Converter(autoApply = true)
class InventoryLotLineStringConverter: AttributeConverter<InventoryLotLineStatus, String> {
    override fun convertToDatabaseColumn(status: InventoryLotLineStatus?): String? {
        return status?.value
    }

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