package com.ffii.fpsms.modules.deliveryOrder.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.purchaseOrder.entity.PurchaseOrderLine
import jakarta.persistence.*
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Size
import java.math.BigDecimal

@Entity
@Table(name = "delivery_order_line")
open class DeliveryOrderLine: BaseEntity<Long>() {
    @ManyToOne
    @JoinColumn(name = "purchaseOrderLineId")
    open var purchaseOrderLine: PurchaseOrderLine? = null

    @NotNull
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @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(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "uomId", nullable = false)
    open var uom: UomConversion? = null

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