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

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

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

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