package com.ffii.fpsms.modules.productProcess.entity

import com.ffii.core.entity.BaseEntity
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 = "productionprocessissue")  //  修复：改为正确的表名
open class ProductionProcessIssue : BaseEntity<Long>() {  //  修复：改为正确的类名
    
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "productprocessid", nullable = false)
    open var productProcess: ProductProcess? = null


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

    
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "operatorId")
    open var operator: User? = null
    
    @Size(max = 100)
    @Column(name = "operatorName", length = 100)
    open var operatorName: String? = null
    
    @NotNull
    @Column(name = "reason", nullable = false)
    open var reason: String? = null
    
    @NotNull
    @Column(name = "stopTime", nullable = false)
    open var stopTime: LocalDateTime? = null
    
    @Column(name = "resumeTime")
    open var resumeTime: LocalDateTime? = null
    
    @Column(name = "totalTime")
    open var totalTime: Int? = null // 分钟
    @Column(name = "status")
    open var status: String? = null
}