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

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

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

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