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 com.ffii.fpsms.modules.pickOrder.entity.PickOrderLine
import jakarta.persistence.*
import jakarta.validation.constraints.NotNull
import java.time.LocalDateTime

@Entity
@Table(name = "stock_out_line")
open class StockOutLine: BaseEntity<Long>() {
    @NotNull
    @OneToOne
    @JoinColumn(name = "itemId")
    open var item: Items? = null

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

    @JsonBackReference
    @NotNull
    @ManyToOne
    @JoinColumn(name = "stockOutId")
    open var stockOut: StockOut? = null

    @JsonBackReference
    @ManyToOne
    @JoinColumn(name = "inventoryLotLineId")
    open var inventoryLotLine: InventoryLotLine? = null

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

    @Column(name = "pickTime")
    open var pickTime: LocalDateTime? = null

    @Column(name = "handled_by")
    open var handledBy: Long? = null

    @JsonBackReference
    @ManyToOne
    @JoinColumn(name = "pickOrderLineId")
    open var pickOrderLine: PickOrderLine? = null

    @Column(name = "type")
    open var type: String? = null

    @JsonBackReference
    @ManyToOne
    @JoinColumn(name = "stockTransferId")
    open var stockTransferRecord: StockTransferRecord? = null

    @Column(name = "startTime")
    open var startTime: LocalDateTime? = null
    @Column(name = "endTime")
    open var endTime: LocalDateTime? = null
}