// StockTakeRecord.kt
package com.ffii.fpsms.modules.stock.entity

import com.ffii.core.entity.BaseEntity
import com.ffii.fpsms.modules.master.entity.Warehouse
import jakarta.persistence.*
import java.math.BigDecimal
import java.time.LocalDate
import java.time.LocalDateTime

@Entity
@Table(name = "stocktakerecord")
open class StockTakeRecord : BaseEntity<Long>() {
    @Column(name = "itemId", nullable = false)
    open var itemId: Long? = null
    
    @Column(name = "lotId", nullable = false)
    open var lotId: Long? = null
    
    @ManyToOne
    @JoinColumn(name = "warehouseId", nullable = false)
    open var warehouse: Warehouse? = null
    
    @Column(name = "stockTakeSection", length = 255)
    open var stockTakeSection: String? = null
    
    @ManyToOne
    @JoinColumn(name = "stockTakeId", nullable = false)
    open var stockTake: StockTake? = null

    @Column(name = "stockTakeRoundId")
    open var stockTakeRoundId: Long? = null
    
    @Column(name = "approverId")
    open var approverId: Long? = null
    
    @Column(name = "approverName", length = 100)
    open var approverName: String? = null
    
    @Column(name = "stockTakerId", nullable = false)
    open var stockTakerId: Long? = null
    
    @Column(name = "stockTakerName", length = 100) 
    open var stockTakerName: String? = null
    @Column(name = "pickerFirstStockTakeQty", precision = 14, scale = 2)
    open var pickerFirstStockTakeQty: BigDecimal? = null
    
    @Column(name = "pickerSecondStockTakeQty", precision = 14, scale = 2)
    open var pickerSecondStockTakeQty: BigDecimal? = null
    
    @Column(name = "approverStockTakeQty", precision = 14, scale = 2)
    open var approverStockTakeQty: BigDecimal? = null
    
    @Column(name = "approverSecondStockTakeQty", precision = 14, scale = 2)
    open var approverSecondStockTakeQty: BigDecimal? = null
    
    @Column(name = "bookQty", nullable = false, precision = 14, scale = 2)
    open var bookQty: BigDecimal? = null
    
    @Column(name = "badQty", precision = 14, scale = 2)
    open var badQty: BigDecimal? = null
    @Column(name = "pickerFirstBadQty", precision = 14, scale = 2)
    open var pickerFirstBadQty: BigDecimal? = null
    @Column(name = "pickerSecondBadQty", precision = 14, scale = 2)
   open var pickerSecondBadQty: BigDecimal? = null
    @Column(name = "approverBadQty", precision = 14, scale = 2)
    open var approverBadQty: BigDecimal? = null
    
    @Column(name = "varianceQty", precision = 14, scale = 2)
    open var varianceQty: BigDecimal? = null
    
    @Column(name = "uom", length = 30)
    open var uom: String? = null
    
    @Column(name = "stockTakeStartTime")
    open var stockTakeStartTime: LocalDateTime? = null
    
    @Column(name = "stockTakeEndTime")
    open var stockTakeEndTime: LocalDateTime? = null

    @Column(name = "lastSelect")
    open var lastSelect: Int? = null

    @Column(name = "approverTime")
    open var approverTime: LocalDateTime? = null
    @Column(name = "date", nullable = false)
    open var date: LocalDate? = null
    
    @Column(name = "status", nullable = false, length = 30)
    open var status: String? = null
    
    @Column(name = "remarks", length = 500)
    open var remarks: String? = null
    
    @Column(name = "itemCode", length = 50)
    open var itemCode: String? = null
    
    @Column(name = "itemName", length = 200)
    open var itemName: String? = null
    

    @Column(name = "inventoryLotId")
    open var inventoryLotId: Long? = null
    
    @Column(name = "lotNo", length = 512)
    open var lotNo: String? = null
    
    @Column(name = "expiredDate")
    open var expiredDate: LocalDate? = null
}