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

import com.fasterxml.jackson.annotation.JsonManagedReference
import com.ffii.core.entity.BaseEntity
import jakarta.persistence.*
import java.time.LocalDateTime

@Entity
@Table(name = "production_schedule")
open class ProductionSchedule : BaseEntity<Long>() {
        @Column(name = "scheduleAt")
        open var scheduleAt: LocalDateTime = LocalDateTime.now()

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

        @Column(name = "totalEstProdCount")
        open var totalEstProdCount: Double = 0.0

        @Column(name = "totalFGType")
        open var totalFGType: Long = 0L

        @Column(name = "type")
        open var type: String = "manual"

        @JsonManagedReference
        @OneToMany(mappedBy = "productionSchedule", cascade = [CascadeType.ALL], orphanRemoval = true)
        open var productionScheduleLines: MutableList<ProductionScheduleLine> = mutableListOf()
}
