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

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

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

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