package com.ffii.fpsms.modules.stock.entity

import com.fasterxml.jackson.annotation.JsonBackReference
import com.ffii.core.entity.BaseEntity
import com.ffii.fpsms.modules.master.entity.Items
import jakarta.persistence.*
import jakarta.validation.constraints.NotNull
import java.math.BigDecimal

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

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

    @Column(name = "itemCode", length = 50)
    open var itemCode: String? = null

    @Column(name = "itemName", length = 200)
    open var itemName: String? = null

    @Column(name = "lotNo", length = 512)
    open var lotNo: String? = null

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

    @Column(name = "startLocation", length = 255)
    open var startLocation: String? = null

    @Column(name = "targetLocation", length = 255)
    open var targetLocation: String? = null

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

    @JsonBackReference
    @ManyToOne
    @JoinColumn(name = "stockOutLineId")
    open var stockOutLine: StockOutLine? = null
}