package com.ffii.fpsms.modules.master.entity

import com.ffii.core.entity.BaseEntity
import jakarta.persistence.CascadeType
import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.JoinColumn
import jakarta.persistence.JoinTable
import jakarta.persistence.OneToMany
import jakarta.persistence.Table
import jakarta.validation.constraints.NotNull

@Entity
@Table(name = "qc_category")
open class QcCategory : BaseEntity<Long>() {
    @NotNull
    @Column(name = "code")
    open var code: String? = null

    @NotNull
    @Column(name = "name")
    open var name: String? = null

    @OneToMany(cascade = [CascadeType.ALL])
    @JoinTable(
        name = "qc_item_category",
        joinColumns = [JoinColumn(name = "qcCategoryId")],
        inverseJoinColumns = [JoinColumn(name = "qcItemId")]
    )
    open var qcItems: MutableSet<QcItem> = mutableSetOf()
}