package com.ffii.fpsms.modules.pickOrder.enums

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

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

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