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.Currency
import com.ffii.fpsms.modules.master.entity.Items
import com.ffii.fpsms.modules.master.entity.UomConversion
import jakarta.persistence.*
import jakarta.validation.constraints.NotNull
import java.math.BigDecimal

@Entity
@Table(name = "inventory")
open class Inventory: BaseEntity<Long>(){
//    @NotNull
    @Column(name = "onHandQty")
    open var onHandQty: BigDecimal? = null

//    @NotNull
    @Column(name = "onHoldQty")
    open var onHoldQty: BigDecimal? = null

//    @NotNull
    @Column(name = "unavailableQty")
    open var unavailableQty: BigDecimal? = null

//    @NotNull
    @Column(name = "price")
    open var price: BigDecimal? = null

    @JsonBackReference
    @ManyToOne
    @JoinColumn(name = "itemId")
    open var item: Items? = null

    @ManyToOne
    @JoinColumn(name = "currencyId")
    open var currency: Currency? = null

//    @NotNull
    @Column(name = "cpu") // cost per unit
    open var cpu: BigDecimal? = null

//    @NotNull
    @Column(name = "cpuUnit")
    open var cpuUnit: String? = null

//    @NotNull
    @Column(name = "cpm") // cost per unit
    open var cpm: BigDecimal? = null

//    @NotNull
    @Column(name = "cpmUnit")
    open var cpmUnit: String? = null

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

//    @NotNull
    @Column(name = "status")
    open var status: String? = null
}