package com.ffii.fpsms.modules.qc.entity

import com.ffii.core.entity.BaseEntity
import com.ffii.fpsms.modules.stock.entity.StockInLine
import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.JoinColumn
import jakarta.persistence.ManyToOne
import jakarta.persistence.Table
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Size
import java.math.BigDecimal

@Entity
@Table(name = "qc_result_measurement")
open class QcResultMeasurement : BaseEntity<Long>() {
    @NotNull
    @ManyToOne
    @JoinColumn(name = "qcResultId", nullable = false)
    open var qcResult: QcResult? = null

    @ManyToOne
    @JoinColumn(name = "stockInLineId")
    open var stockInLine: StockInLine? = null

    @NotNull
    @Size(max = 45)
    @Column(name = "qcType", nullable = false, length = 45)
    open var qcType: String? = null

    @Size(max = 100)
    @Column(name = "orderRefCode", length = 100)
    open var orderRefCode: String? = null

    @NotNull
    @Size(max = 45)
    @Column(name = "measureType", nullable = false, length = 45)
    open var measureType: String? = null

    @Column(name = "value", precision = 14, scale = 2)
    open var value: BigDecimal? = null

    @Size(max = 20)
    @Column(name = "unit", length = 20)
    open var unit: String? = null
}
