package com.sckw.order.model.vo.req;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

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

/**
 * @desc: 采购订单请求参数
 * @author: yzc
 * @date: 2023-07-07 14:19
 */
@Getter
@Setter
@ToString
public class TradeOrderParam {
    @NotNull(message = "商品id不能为空")
    @Schema(description = "商品id")
    private Long goodsId;

    /**
     * 贸易合同
     */
    @NotNull(message = "贸易合同不能为空")
    @Schema(description = "贸易合同")
    private Long tradeContractId;

    @NotBlank(message = "贸易合同名称不能为空")
    @Schema(description = "贸易合同名称")
    private String tradeContractName;
    private String tradeContractNo;
    /**
     * 订单总量
     */
    @NotNull(message = "采购数量不能为空")
    @DecimalMin(value = "0.01", message = "采购数量必须大于零")
    @Schema(description = "采购数量")
    private BigDecimal amount;
    /**
     * 备注
     */
    @Length(max = 200, message = "备注最多支持200字")
    @Schema(description = "备注")
    private String remark;

    /**
     * 收货信息
     */
    @NotNull(message = "收货信息不能为空")
    @Schema(description = "收货信息")
    private AddressInfoPara addressInfo;

    /**
     * 物流合同 承运单位
     * 合同托运方式是“采购方托运”时，才展示物流信息填写，“供应方托运”时隐藏这一块
     * 买方托运时，可以选择平台默认物流
     */
    @Schema(description = "物流合同信息")
    private List<LogisticsEntDto> logisticsContractList;

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

    /**
     * 库存不足时是否确认继续下单
     */
    @Schema(description = "库存不足确认继续下单")
    private Boolean confirmInsufficientStock;

}
