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

import java.math.BigDecimal
import java.time.LocalDate
import java.time.LocalDateTime

// Production Schedule
interface ProdScheduleInfo {
    val id: Long?
    val scheduleAt: LocalDate?
    val produceAt: LocalDate?
    val schedulePeriod: LocalDate?
    val schedulePeriodTo: LocalDate?
    val totalEstProdCount: BigDecimal?
    val totalFGType: Long?
    val type: String?
}
// Detailed Production Schedule With Line
interface DetailedProdScheduleWithLineWithJsonString {
    val id: Long?
    val produceAt: LocalDateTime?
    val scheduleAt: LocalDateTime?
    val totalEstProdCount: BigDecimal?
    val totalFGType: Long?
//    val prodScheduleLines: List<DetailedProdScheduleLineInfo>?
    val prodScheduleLines: String?
}

data class DetailedProdScheduleWithLine (
    val id: Long?,
    val produceAt: LocalDateTime?,
    val scheduleAt: LocalDateTime?,
    val totalEstProdCount: BigDecimal?,
    val totalFGType: Long?,
    val prodScheduleLines: List<DetailedProdScheduleLineInfo>?
)

data class DetailedProdScheduleLineInfo(
    val id: Long?,
    val bomMaterials: List<DetailedProdScheduleLineBomMaterial>?,
    val jobNo: String?,
    val code: String?,
    val name: String?,
    val type: String?,
    val demandQty: BigDecimal?,
    val bomOutputQty: BigDecimal?,
    val prodTimeInMinute: List<DetailedProdScheduleLineProdTime>?,
    val priority: BigDecimal?,
    val approved: Boolean?,
    val proportion: BigDecimal?,
    val uomName: String?,
    val daysLeft: BigDecimal?,
    val onHandQty: BigDecimal?,
    val stockQty: BigDecimal?,
    val outputQty: BigDecimal?,
    val prodQty: BigDecimal?,
    val lastMonthAvgSales: BigDecimal?,
    val avgQtyLastMonth: BigDecimal?,
    val needNoOfJobOrder: BigDecimal?,
    val batchNeed: BigDecimal?,
    val itemPriority: BigDecimal?,
)

data class DetailedProdScheduleLineBomMaterial (
    val id: Long?,
    val code: String?,
    val name: String?,
    val type: String?,
    val availableQty: BigDecimal?,
    val demandQty: BigDecimal?,
    val uomName: String?,
)

interface DetailedProdScheduleLineBomMaterialInterface {
    val id: Long?
    val code: String?
    val name: String?
    val type: String?
    val availableQty: BigDecimal?
}

data class DetailedProdScheduleLineProdTime (
    val equipName: String?,
    val totalMinutes: BigDecimal?
)

// Rough Production Schedule With Line
data class RoughProdScheduleWithLine(
    val id: Long?,
    val scheduleAt: LocalDateTime?,
    val schedulePeriod: LocalDateTime?,
    val schedulePeriodTo: LocalDateTime?,
    val totalEstProdCount: BigDecimal?,
    val totalFGType: Long?,
    val type: String?,
    val prodScheduleLinesByFg: List<RoughProdScheduleLineInfoByFg>,
    val prodScheduleLinesByFgByDate: Map<Long?, List<RoughProdScheduleLineInfoByFg>>,
    val prodScheduleLinesByBom: List<RoughProdScheduleLineInfoByBom>,
    val prodScheduleLinesByBomByDate: Map<Long?, List<RoughProdScheduleLineInfoByBomByDate>>
)

data class RoughProdScheduleLineInfoByFg(
    val id: Long?,
    val code: String?,
    val name: String?,
    val type: String?,
    val availableQty: BigDecimal?,
    val prodQty: BigDecimal?,
    val lastMonthAvgSales: BigDecimal?,
    val estCloseBal: BigDecimal?,
    val priority: Long?,
    val bomMaterials: List<RoughProdScheduleLineBomMaterialInfoByFg>?,
    val assignDate: Long?,
    val uomName: String?,
)

data class RoughProdScheduleLineBomMaterialInfoByFg(
    val id: Long?,
    val code: String?,
    val name: String?,
    val type: String?,
    val availableQty: BigDecimal?,
    val demandQty: BigDecimal?,
    val uomName: String?
)

data class RoughProdScheduleLineInfoByBom(
    val id: Long?,
    val code: String?,
    val name: String?,
    val type: String?,
    val availableQty: BigDecimal?,
    val totalDemandQty: BigDecimal?,
    val demandQty1: BigDecimal?,
    val demandQty2: BigDecimal?,
    val demandQty3: BigDecimal?,
    val demandQty4: BigDecimal?,
    val demandQty5: BigDecimal?,
    val demandQty6: BigDecimal?,
    val demandQty7: BigDecimal?,
    val uomName: String?,
)

data class RoughProdScheduleLineInfoByBomByDate(
    val id: Long?,
    val code: String?,
    val name: String?,
    val type: String?,
    val availableQty: BigDecimal?,
    val demandQty: BigDecimal?,
    val assignDate: Long?,
    val uomName: String?,
)