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

import com.ffii.core.entity.BaseEntity
import com.ffii.fpsms.m18.entity.M18DataLog
import com.ffii.fpsms.modules.master.entity.Shop
import com.ffii.fpsms.modules.purchaseOrder.entity.PurchaseOrder
import com.ffii.fpsms.modules.stock.entity.enum.StockInStatus
import jakarta.persistence.*
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Size
import java.time.Instant
import java.time.LocalDate
import java.time.LocalDateTime

@Entity
@Table(name = "stock_in")
open class StockIn : BaseEntity<Long>() {
    @Size(max = 30)
    @NotNull
    @Column(name = "code", nullable = false, length = 30)
    open var code: String? = null

    @ManyToOne
    @JoinColumn(name = "supplierId")
    open var supplier: Shop? = null

    @ManyToOne
    @JoinColumn(name = "shopId")
    open var shop: Shop? = null

    @OneToOne
    @JoinColumn(name = "m18DataLogId")
    open var m18DataLog: M18DataLog? = null

    @OneToOne
    @JoinColumn(name = "purchaseOrderId")
    open var purchaseOrder: PurchaseOrder? = null

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

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

    @Column(name = "estimatedCompleteDate")
    open var estimatedCompleteDate: LocalDate? = null

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

    @NotNull
    @Column(name = "status", nullable = false, length = 10)
//    @Enumerated(EnumType.STRING)
    open var status: String? = null
}