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

import com.ffii.core.entity.BaseEntity
import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.JoinColumn
import jakarta.persistence.OneToOne
import jakarta.persistence.Table
import jakarta.validation.constraints.NotNull
import java.time.LocalDate
@Entity
@Table(name = "stock_ledger")
open class StockLedger: BaseEntity<Long>() {
  @OneToOne
   @JoinColumn(name = "stockInLineId")
  open var stockInLine: StockInLine? = null

    @OneToOne
    @JoinColumn(name = "stockOutLineId")
    open var stockOutLine: StockOutLine? = null

    @NotNull
    @OneToOne
    @JoinColumn(name = "inventoryId")
    open var inventory: Inventory? = null

    @Column(name = "inQty")
    open var inQty: Double? = null

    @Column(name = "outQty")
    open var outQty: Double? = null

    @Column(name = "balance")
    open var balance: Double? = null

    /** 物料庫存單位對應之 uom_conversion.id（與 item_uom / inventory 之 stock UOM 一致） */
    @Column(name = "uomId")
    open var uomId: Long? = null

    @Column(name = "type")
    open var type: String? = null
    @Column(name = "itemId")
    open var itemId: Long? = null
    @Column(name = "itemCode")
    open var itemCode: String? = null
    @Column(name = "date")
    open var date: LocalDate? = null
}