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

import com.ffii.core.entity.BaseEntity
import com.ffii.fpsms.modules.master.entity.Equipment
import com.ffii.fpsms.modules.user.entity.User
import jakarta.persistence.*
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Size
import java.time.LocalDateTime

@Entity
@Table(name = "job_order_process_detail")
open class JobOrderProcessDetail: BaseEntity<Long>() {
    @NotNull
    @ManyToOne
    @JoinColumn(name = "jopId", nullable = false)
    open var jop: JobOrderProcess? = null

    @NotNull
    @ManyToOne
    @JoinColumn(name = "equipmentId", nullable = false)
    open var equipment: Equipment? = null

    @NotNull
    @ManyToOne
    @JoinColumn(name = "operatorId", nullable = false, referencedColumnName = "id")
    open var operator: User? = null

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

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

    @Size(max = 500)
    @Column(name = "remarks", length = 500)
    open var remarks: String? = null
}