package com.ffii.fpsms.modules.jobOrder.entity

import com.ffii.core.entity.BaseEntity
import com.ffii.fpsms.modules.master.entity.Items
import com.ffii.fpsms.modules.master.entity.UomConversion
import com.ffii.fpsms.modules.stock.entity.InventoryLotLine
import jakarta.persistence.*
import jakarta.validation.constraints.NotNull
import java.math.BigDecimal

@Entity
@Table(name = "job_order_material")
open class JobOrderMaterial : BaseEntity<Long>() {

    @NotNull
    @ManyToOne
    @JoinColumn(name = "jopId", nullable = false)
    open var jop: JobOrderProcess? = null

    @NotNull
    @ManyToOne
    @JoinColumn(name = "itemId", nullable = false)
    open var item: Items? = null

    @NotNull
    @Column(name = "qty", nullable = false, precision = 14, scale = 2)
    open var qty: BigDecimal? = null

    @NotNull
    @ManyToOne
    @JoinColumn(name = "uomId", nullable = false)
    open var uom: UomConversion? = null

    @ManyToOne
    @JoinColumn(name = "inventoryLotLineId")
    open var inventoryLotLine: InventoryLotLine? = null

    @NotNull
    @ManyToOne
    @JoinColumn(name = "joProcessDetailId", nullable = false)
    open var joProcessDetail: JobOrderProcessDetail? = null
}