package com.ffii.fpsms.modules.jobOrder.enums

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

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

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