package com.ffii.fpsms.py.entity

import com.ffii.core.entity.BaseEntity
import com.ffii.fpsms.modules.jobOrder.entity.JobOrder
import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.FetchType
import jakarta.persistence.JoinColumn
import jakarta.persistence.ManyToOne
import jakarta.persistence.Table
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Size

/**
 * One row each time a Bag/py client submits a print quantity for a job order (per printer channel).
 * [printChannel] distinguishes 打袋 (DATAFLEX), 標籤 (LABEL), 激光 (LASER); cumulative [qty] per channel.
 */
@Entity
@Table(name = "py_job_order_print_submit")
open class PyJobOrderPrintSubmit : BaseEntity<Long>() {

    @NotNull
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "job_order_id", nullable = false, columnDefinition = "INT")
    open var jobOrder: JobOrder? = null

    @NotNull
    @Column(name = "qty", nullable = false)
    open var qty: Int? = null

    @Size(max = 32)
    @NotNull
    @Column(name = "print_channel", nullable = false, length = 32)
    open var printChannel: String? = null
}
