package com.ffii.fpsms.modules.deliveryOrder.web.models

import com.fasterxml.jackson.annotation.JsonFormat
import jakarta.validation.Valid
import jakarta.validation.constraints.NotEmpty
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Positive
import java.math.BigDecimal
import java.time.LocalDate
import java.time.LocalDateTime

data class SubmitDoReplenishmentLineRequest(
    @field:NotNull
    @field:JsonFormat(pattern = "yyyy-MM-dd")
    val deliveryDate: LocalDate,
    @field:NotNull
    val sourceDoId: Long,
    @field:NotNull
    val sourceDoLineId: Long,
    @field:NotNull
    @field:Positive
    val replenishQty: BigDecimal,
    val truckLaneCode: String? = null,
    val reason: String? = null,
)

data class SubmitDoReplenishmentRequest(
    @field:NotEmpty
    @field:Valid
    val lines: List<SubmitDoReplenishmentLineRequest>,
)

data class DoReplenishmentResponse(
    val id: Long,
    val code: String,
    @JsonFormat(pattern = "yyyy-MM-dd")
    val deliveryDate: LocalDate,
    val sourceDoId: Long,
    val sourceDoCode: String?,
    val sourceDoLineId: Long,
    val itemId: Long,
    val itemNo: String?,
    val itemName: String?,
    val originalQty: BigDecimal?,
    val actualPickQty: BigDecimal?,
    val replenishQty: BigDecimal,
    val shortUom: String?,
    val shopCode: String?,
    val shopName: String?,
    val truckLaneCode: String?,
    val targetDoId: Long?,
    val targetDoCode: String?,
    @JsonFormat(pattern = "yyyy-MM-dd")
    val targetDoEstimatedArrivalDate: LocalDate?,
    val pickOrderLineId: Long?,
    val deliveryOrderPickOrderId: Long?,
    val relateTicketNo: String?,
    val status: String,
    val reason: String?,
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    val created: LocalDateTime?,
)
