package com.sckw.transport.model.param;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.sckw.transport.model.dto.LogisticsEntDto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;

/**
 * @author lfdc
 * @description 物流订单自建订单v4.2
 * @date 2024-03-05 09:03:01
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CreateLogisticsOrderParam implements Serializable {
    /**
     * 合同id
     */
    @NotNull(message = "物流合同信息不能为空")
    @Schema(description = "物流合同信息")
    private List<LogisticsEntDto> logisticsContractList;

    @NotNull(message = "goodsId不能为空")
    @Schema(description = "商品id")
    private Long goodsId;

    /**
     * 总量
     */
    @NotNull(message = "总量不能为空")
    @Digits(integer = 10, fraction = 2, message = "总量格式错误")
    @DecimalMin(value = "0.00", message = "总量最小值为{value}")
    @Schema(description = "总量")
    private BigDecimal amount;


    /**
     * 运输时间
     */
    @NotNull(message = "结束运输时间不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @Schema(description = "结束运输时间")
    private LocalDate endTime;

    /**
     * 开始运输时间
     */
    @NotNull(message = "开始运输时间不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @Schema(description = "开始运输时间")
    private LocalDate startTime;


    @NotNull(message = "装货地址不能为空")
    @Schema(description = "装货地址")
    private CreateLogisticsAddressParam loadAddress;

    @NotNull(message = "卸货地址不能为空")
    @Schema(description = "卸货地址")
    private CreateLogisticsAddressParam unloadAddress;


}
