package com.yiqi.order.domain.dto;

import com.yiqi.order.domain.OrderGoods;
import com.yiqi.order.domain.OrderPurchaseGoods;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;

/**
 * @author xiaohei
 * @date 2024/1/22
 */
@Data
public class OrderThirdDeliveryPathDTO {

    @NotEmpty(message = "微信小程序openId不能为空")
    @ApiModelProperty("微信小程序openId")
    private String openId;

    @NotEmpty(message = "配送公司ID不能为空")
    @ApiModelProperty("配送公司ID")
    private String deliveryId;

    @NotEmpty(message = "运单ID不能为空")
    @ApiModelProperty("运单ID")
    private String waybillId;

    public static OrderThirdDeliveryPathDTO buildDeliveryPathByGoodsOrder(OrderGoods orderGoods, String openId){
        OrderThirdDeliveryPathDTO orderThirdDeliveryPathDTO = new OrderThirdDeliveryPathDTO();
        orderThirdDeliveryPathDTO.setOpenId(openId);
        orderThirdDeliveryPathDTO.setDeliveryId(orderGoods.getDeliveryId());
        orderThirdDeliveryPathDTO.setWaybillId(orderGoods.getDeliveryNo());
        return orderThirdDeliveryPathDTO;
    }

    public static OrderThirdDeliveryPathDTO buildDeliveryPathByPurchaseGoodsOrder(OrderPurchaseGoods orderPurchaseGoods){
        OrderThirdDeliveryPathDTO orderThirdDeliveryPathDTO = new OrderThirdDeliveryPathDTO();
        orderThirdDeliveryPathDTO.setDeliveryId(orderPurchaseGoods.getDeliveryId());
        orderThirdDeliveryPathDTO.setWaybillId(orderPurchaseGoods.getDeliveryNo());
        return orderThirdDeliveryPathDTO;
    }
}
