package com.ffii.fpsms.modules.jobOrder.web.model

import com.ffii.fpsms.modules.jobOrder.enums.JobOrderBomMaterialStatus
import java.math.BigDecimal
import java.time.LocalDateTime
import java.time.LocalDate
data class CreateJobOrderRequest (
    val bomId: Long?,
    val planStart: LocalDateTime? = null,
    val planEnd: LocalDateTime? = null,
    val reqQty: BigDecimal?,
    //val jobType: String?=null,
    val jobTypeId: Long?=null,
    val type: String? = "detailed",
    val approverId: Long? = null,
    val prodScheduleLineId: Long? = null,
    val status: String = "planning",
    val productionPriority: Int?=50,
)

data class CreateJobOrderBomMaterialRequest (
    val joId: Long?,
    val itemId: Long?,
    val reqQty: BigDecimal?,
    val uomId: Long?,
    val status: String = JobOrderBomMaterialStatus.PENDING.value,
)

data class CreateJobOrderProcessRequest (
    val joId: Long?,
    val processId: Long?,
    val seqNo: Long?,
    val remarks: String? = null,
    val status: String = "pending",
)


data class AllJoPickOrderResponse(
    val id: Long,
    val pickOrderId: Long?,
    val pickOrderCode: String?,  
    val jobOrderId: Long?,
    val jobOrderCode: String?,
    val jobOrderTypeId: Long?,
    val jobOrderType: String?,
    val itemId: Long,
    val itemName: String,
    val reqQty: BigDecimal,
    val uomId: Long,
    val uomName: String,
    val jobOrderStatus: String,
    val finishedPickOLineCount: Int,

)


data class UpdateJoPickOrderHandledByRequest(
    val pickOrderId: Long,
    val itemId: Long,
    val userId: Long
)
data class JobOrderLotsHierarchicalResponse(
    val pickOrder: PickOrderInfoResponse,
    val pickOrderLines: List<PickOrderLineWithLotsResponse>
)

data class PickOrderInfoResponse(
    val id: Long?,
    val code: String?,
    val consoCode: String?,
    val targetDate: String?,
    val type: String?,
    val status: String?,
    val assignTo: Long?,
    val jobOrder: JobOrderBasicInfoResponse
)

data class JobOrderBasicInfoResponse(
    val id: Long,
    val code: String,
    val name: String
)

data class PickOrderLineWithLotsResponse(
    val id: Long,
    val itemId: Long?,
    val itemCode: String?,
    val itemName: String?,
    val requiredQty: Double?,
    val uomCode: String?,
    val uomDesc: String?,
    val status: String?,
    val lots: List<LotDetailResponse>,
    val handler: String?
)

data class LotDetailResponse(
    val lotId: Long?,
    val lotNo: String?,
    val expiryDate: String?,
    val location: String?,
    val availableQty: Double?,
    val requiredQty: Double?,
    val actualPickQty: Double?,
    val processingStatus: String?,
    val lotAvailability: String?,
    val pickOrderId: Long?,
    val pickOrderCode: String?,
    val pickOrderConsoCode: String?,
    val pickOrderLineId: Long?,
    val stockOutLineId: Long?,
    val stockInLineId: Long?,
    val suggestedPickLotId: Long?,
    val stockOutLineQty: Double?,
    val stockOutLineStatus: String?,
    val routerIndex: String?,
    val routerArea: String?,
    val routerRoute: String?,
    val uomShortDesc: String?,
    val matchStatus: String?,
    val matchBy: Long?,
    val matchQty: Double?
)


data class JobOrderListForPrintQrCodeResponse(
    val id: Long,
    val code: String,
    val name: String,
    val reqQty: BigDecimal,
    val stockInLineId: Long,
    val stockInLineQty: Double,
    val stockInLineStatus: String,
    val finihedTime: LocalDateTime,
)
data class UpdateJoPlanStartRequest(
    val id: Long,
    val planStart: String,
)
data class CheckJobOrderCreatedRequest(
    val bomId: Long,
    val date: LocalDate,
)
data class CheckJobOrderCreatedResponse(
    val isCreated: Boolean,
    val jobOrders: List<JobOrderInfoResponse>,
)
data class JobOrderInfoResponse(
    val jobOrderId: Long,
    val code: String,
    val itemName: String,
    val reqQty: BigDecimal,
)
data class UpdateJoReqQtyRequest(
    val id: Long,
    val reqQty: Int
)