package com.hys.app.model.erp.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.hys.app.model.erp.dos.*;
import com.hys.app.model.erp.enums.OrderPaymentStatusEnum;
import com.hys.app.model.erp.enums.OrderSendTypeEnum;
import com.hys.app.model.erp.enums.OrderTypeEnum;
import com.hys.app.model.goods.dos.BrandDO;
import com.hys.app.model.goods.dos.CategoryDO;
import com.hys.app.model.system.dos.DeptDO;
import com.hys.app.model.erp.enums.OrderDeliveryType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.Valid;
import javax.validation.constraints.*;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 订单 新增|编辑 请求参数
 *
 * @author 张崧
 * 2024-01-24 15:58:31
 */
@Data
@ApiModel(value = "订单 新增|编辑 请求参数")
public class OrderDTO {

    @JsonIgnore
    @ApiModelProperty(hidden = true)
    private Long id;

    @ApiModelProperty(name = "type", value = "订单类型")
    @NotNull(message = "订单类型不能为空")
    private OrderTypeEnum type;


    @ApiModelProperty(name = "order_time", value = "下单时间")
    @NotNull(message = "下单时间不能为空")
    private Long orderTime;

    @ApiModelProperty(name = "pay_type", value = "支付方式")
//    @NotNull(message = "支付方式不能为空")
    private String payType;

    @ApiModelProperty(name = "marketing_id", value = "销售人员")
    private Long marketingId;

    @ApiModelProperty(name = "member_id", value = "客户id选填")
    private Long memberId;

    @ApiModelProperty(name = "attachment", value = "附件")
    private String customerPhone;

    @ApiModelProperty(name = "attachment", value = "附件")
    private String customerName;

    @ApiModelProperty(name = "warehouse_id", value = "仓库id")
    @NotNull(message = "仓库id不能为空")
    private List<Long> warehouseId;

    @ApiModelProperty(name = "return_warehouse_id", value = "仓库id")
    private Long returnWarehouseId;

    @ApiModelProperty(name = "attachment", value = "附件")
    private String attachment;

    @ApiModelProperty(name = "remark", value = "备注")
    private String remark;

//    @ApiModelProperty(name = "delivery_type", value = "配送方式")
//    private OrderDeliveryType deliveryType;

    @ApiModelProperty(name = "send_type", value = "配送方式")
    private OrderSendTypeEnum sendType;

    @ApiModelProperty(name = "item_list", value = "订单项列表")
    @NotEmpty(message = "订单项不能为空")
    @Valid
    private List<OrderItemDTO> itemList;


    @ApiModelProperty(name = "pay_price", value = "应付金额")
    @NotNull(message = "应付金额不能为空")
    @Min(value = 0, message = "应付金额不能小于0")
    private Double payPrice;

    @ApiModelProperty(name = "real_price", value = "打折后的金额不能为空")
    @NotNull(message = "打折后的金额不能为空")
    @Min(value = 0, message = "打折后的金额不能为空能小于0")
    private Double realPrice;


    @ApiModelProperty(name = "province_city_area_address", value = "地址不能为空")
//    @NotBlank(message = "地址不能为空")
    private String provinceCityAreaAddress;

    @ApiModelProperty(name = "address", value = "地址不能为空")
//    @NotBlank(message = "地址不能为空")
    private String address;

    @ApiModelProperty(name = "province_city_area", value = "地址不能为空")
//    @NotBlank(message = "地址不能为空")
    private String provinceCityArea;

    @ApiModelProperty(name = "end_time", value = "开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;

    @ApiModelProperty(name = "start_time", value = "结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startTime;

    @ApiModelProperty(name = "subtract_stock", value = "是否允许负库存")
    private Boolean subtractStock;


}

