package com.ffii.fpsms.modules.jobOrder.entity

import jakarta.persistence.*
import java.time.LocalDateTime
import java.time.LocalTime
import com.ffii.fpsms.modules.jobOrder.enums.JoPickOrderStatus
import org.hibernate.annotations.CreationTimestamp
import org.hibernate.annotations.UpdateTimestamp

@Entity
@Table(name = "jo_pick_order")
class JoPickOrder {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    var id: Long? = null
    
    @Column(name = "pick_order_id")
    var pickOrderId: Long? = null

    
    @Column(name = "item_id")
    var itemId: Long? = null
    @Enumerated(EnumType.STRING)
    @Column(name = "second_qr_scan_status")
    var second_qr_scan_status: JoPickOrderStatus? = null
    @Column(name = "second_qr_scan_by")
    var second_qr_scan_by: Long? = null
    @Column(name = "second_qr_scan_qty")
    var second_qr_scan_qty: Int? = null
    @Column(name = "handled_by")
    var handledBy: Long? = null
    
    @CreationTimestamp
    @Column(name = "created")
    var created: LocalDateTime? = null
    
    @Column(name = "createdBy", length = 30)
    var createdBy: String? = null
    
    @Version
    var version: Int = 0
    
    @UpdateTimestamp
    @Column(name = "modified")
    var modified: LocalDateTime? = null
    
    @Column(name = "modifiedBy", length = 30)
    var modifiedBy: String? = null
    
    @Column(name = "deleted")
    var deleted: Boolean = false

    @Column(name = "hide", nullable = false)
    var hide: Boolean = false
    
    // Default constructor for Hibernate
    constructor()
    
    // Constructor for creating new instances
    constructor(
     
        pickOrderId: Long? = null,
        itemId: Long? = null,
        second_qr_scan_status: JoPickOrderStatus? = null,
        second_qr_scan_by: Long? = null,
        second_qr_scan_qty: Int? = null,
        handledBy: Long? = null,
        createdBy: String? = null,
        modifiedBy: String? = null
    ) {
        this.pickOrderId = pickOrderId
        this.itemId = itemId
        this.second_qr_scan_status = second_qr_scan_status
        this.second_qr_scan_by = second_qr_scan_by
        this.second_qr_scan_qty = second_qr_scan_qty
        this.handledBy = handledBy
        this.createdBy = createdBy
        this.modifiedBy = modifiedBy
    }
}