package com.ffii.fpsms.m18.enums

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

@Converter(autoApply = true)
class M18DataLogStatusConverter: AttributeConverter<M18DataLogStatus, Int> {
    override fun convertToDatabaseColumn(status: M18DataLogStatus?): Int? {
        return status?.value
    }

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