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

import java.time.LocalDateTime
import java.time.LocalDate
import com.ffii.fpsms.modules.productProcess.enums.ProductProcessStatus
import com.fasterxml.jackson.annotation.JsonFormat
import com.ffii.fpsms.modules.jobOrder.enums.JobOrderStatus
import java.math.BigDecimal
data class ProductProcessInfo(
    val id: Long?,
    val productProcessCode: String?,
    val status: ProductProcessStatus?,
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    val startTime: LocalDateTime?,
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    val endTime: LocalDateTime?,
    @JsonFormat(pattern = "yyyy-MM-dd")
    val date: LocalDate?,
    
    
    val bomId: Long?,
    val jobOrderId: Long?,
    val jobOrderCode: String?,
    val jobOrderStatus: String?,
    val jobType: String?,
    val bomDescription: String?,
    val isDark: String?,
    val isDense: Int?,
    val isFloat: String?,
    val scrapRate: Int?,
    //val matchStatus: String?,
    val allergicSubstance: String?,
    val itemId: Long?,
    val itemCode: String?,
    val itemName: String?,
    val bomBaseQty: BigDecimal?,
    val outputQtyUom: String?,
    val outputQty: Int?,
    val timeSequence: Int?,
    val complexity: Int?,
    val productionPriority: Int?,
    val submitedBagRecord: Boolean?,
    val productProcessLines: List<ProductProcessLineInfo>?,
    val totalStockQty: Int?,
    val insufficientStockQty: Int?,
    val sufficientStockQty: Int?,
    val jobOrderLines: List<jobOrderLineInfo>?
)

data class ProductProcessLineInfo(
    val id:Long?,
    val processId: Long?,
    val bomprocessId: Long?,
    val operatorId: Long?,
    val operatorName: String?,
    val equipmentId: Long?,
    val equipmentDetailId: Long?,
    val handlerId: Long?,
    val seqNo: Long?,
    val name: String?,
    val description: String?,
    val equipment_name: String?,
    val equipmentDetailCode: String?,
    val status: String?,
    val byproductId: Long?,
    val byproductName: String?,
    val byproductQty: Int?,
    val byproductUom: String?,
    val scrapQty: Int?, 
    val defectQty: Int?, 
    val defectUom: String?, 
    val defectDescription: String?,
    val defectQty2: Int?,
    val defectUom2: String?,
    val defectDescription2: String?,
    val defectQty3: Int?,
    val defectUom3: String?,
    val defectDescription3: String?,
    val outputFromProcessQty: Int?,
    val outputFromProcessUom: String?,
    val durationInMinutes: Int?,
    val prepTimeInMinutes: Int?,
    val postProdTimeInMinutes: Int?,
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    val startTime: LocalDateTime?,
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    val endTime: LocalDateTime?,
    val isOringinal: Boolean?,
)


data class jobOrderLineInfo(
    val id: Long?,
    val itemId: Long?,
    val itemCode: String?,
    val itemName: String?,
    val type: String?,

    val reqQty: Double?,
    val baseReqQty: Long?,


    val stockQty: Int?,
    val stockReqQty: Double?,
    val baseStockQty: Long?,

    val reqUom: String?,
    val reqBaseUom: String?,

    val stockUom: String?,
    val stockBaseUom: String?,
    
    val availableStatus: String?,
    val bomProcessId: Long?,
    val bomProcessSeqNo: Long?
)