package com.ffii.fpsms.modules.stock.enums

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

// Stock Take Line Status
@Converter(autoApply = true)
class StockTakeLineStatusConverter : AttributeConverter<StockTakeLineStatus, String> {
    override fun convertToDatabaseColumn(status: StockTakeLineStatus?): String? {
        return status?.value
    }

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