package com.ffii.fpsms.modules.deliveryOrder.enums

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

// Delivery Order Line Status
@Converter(autoApply = true)
class DeliveryOrderLineStatusConverter : AttributeConverter<DeliveryOrderLineStatus, String>{
    override fun convertToDatabaseColumn(status: DeliveryOrderLineStatus?): String? {
        return status?.value
    }

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