package com.yiqi.order.domain.dto;

import com.google.gson.annotations.SerializedName;
import com.yiqi.app.domain.vo.AppUserInfoVO;
import com.yiqi.common.enums.HqInfoEnums;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 运单收件人、寄件人信息
 * @author xiaohei
 * @date 2024/1/21
 */
@Data
public class OrderThirdDeliveryPersonDTO {

    @ApiModelProperty("发件人姓名，不超过64字节")
    private String name;
    @ApiModelProperty("发件人座机号码，若不填写则必须填写 mobile，不超过32字节")
    private String tel;
    @ApiModelProperty("发件人手机号码，若不填写则必须填写 tel，不超过32字节")
    private String mobile;
    @ApiModelProperty("发件人公司名称，不超过64字节")
    private String company;
    @ApiModelProperty("发件人邮编，不超过10字节")
    private String postCode;
    @ApiModelProperty("发件人省份，比如：\"广东省\"，不超过64字节")
    private String province;
    @ApiModelProperty("发件人市/地区，比如：\"广州市\"，不超过64字节")
    private String city;
    @ApiModelProperty("发件人区/县，比如：\"海珠区\"，不超过64字节")
    private String area;
    @ApiModelProperty("发件人详细地址，比如：\"XX路XX号XX大厦XX\"，不超过512字节")
    private String address;

    /**
     * 构建发件人信息-商品订单
     * @return
     */
    public static OrderThirdDeliveryPersonDTO buildGoodsOrderPersonBySender(){
        OrderThirdDeliveryPersonDTO orderThirdDeliveryPersonDTO = new OrderThirdDeliveryPersonDTO();
        orderThirdDeliveryPersonDTO.setName(HqInfoEnums.contactName.getInfo());
//        orderThirdDeliveryPersonDTO.setTel();
        orderThirdDeliveryPersonDTO.setMobile(HqInfoEnums.contactPhone.getInfo());
        orderThirdDeliveryPersonDTO.setCompany(HqInfoEnums.company.getInfo());
//        orderThirdDeliveryPersonDTO.setPostCode();
        orderThirdDeliveryPersonDTO.setProvince(HqInfoEnums.province.getInfo());
        orderThirdDeliveryPersonDTO.setCity(HqInfoEnums.city.getInfo());
        orderThirdDeliveryPersonDTO.setArea(HqInfoEnums.area.getInfo());
        orderThirdDeliveryPersonDTO.setAddress(HqInfoEnums.address.getInfo());
        return orderThirdDeliveryPersonDTO;
    }

    /**
     * 构建收件人信息-商品订单
     * @return
     */
    public static OrderThirdDeliveryPersonDTO buildGoodsOrderPersonByReceiver(AppUserInfoVO appUserInfo){
        OrderThirdDeliveryPersonDTO orderThirdDeliveryPersonDTO = new OrderThirdDeliveryPersonDTO();
        orderThirdDeliveryPersonDTO.setName(appUserInfo.getRealName());
//        orderThirdDeliveryPersonDTO.setTel(appUserInfo.get);
        orderThirdDeliveryPersonDTO.setMobile(appUserInfo.getPhoneNumber());
//        orderThirdDeliveryPersonDTO.setCompany();
//        orderThirdDeliveryPersonDTO.setPostCode();
        orderThirdDeliveryPersonDTO.setProvince(appUserInfo.getProvince());
        orderThirdDeliveryPersonDTO.setCity(appUserInfo.getCity());
        orderThirdDeliveryPersonDTO.setArea(appUserInfo.getArea());
        orderThirdDeliveryPersonDTO.setAddress(appUserInfo.getAddress());
        return orderThirdDeliveryPersonDTO;
    }

    /**
     * 构建发件人信息-进货订单
     * @return
     */
    public static OrderThirdDeliveryPersonDTO buildPurchaseGoodsOrderPersonBySender(DeliveryOrgInfoDTO deliveryOrgInfoDTO){
        OrderThirdDeliveryPersonDTO orderThirdDeliveryPersonDTO = new OrderThirdDeliveryPersonDTO();
        orderThirdDeliveryPersonDTO.setName(deliveryOrgInfoDTO.getContactName());
        orderThirdDeliveryPersonDTO.setTel(deliveryOrgInfoDTO.getTel());
        orderThirdDeliveryPersonDTO.setMobile(deliveryOrgInfoDTO.getContactPhone());
        orderThirdDeliveryPersonDTO.setCompany(deliveryOrgInfoDTO.getName());
//        orderThirdDeliveryPersonDTO.setPostCode();
        orderThirdDeliveryPersonDTO.setProvince(deliveryOrgInfoDTO.getProvince());
        orderThirdDeliveryPersonDTO.setCity(deliveryOrgInfoDTO.getCity());
        orderThirdDeliveryPersonDTO.setArea(deliveryOrgInfoDTO.getArea());
        orderThirdDeliveryPersonDTO.setAddress(deliveryOrgInfoDTO.getAddress()+deliveryOrgInfoDTO.getAddressDetail());
        return orderThirdDeliveryPersonDTO;
    }

    /**
     * 构建收件人信息-进货订单
     * @return
     */
    public static OrderThirdDeliveryPersonDTO buildPurchaseGoodsOrderPersonByReceiver(DeliveryOrgInfoDTO deliveryOrgInfoDTO){
        OrderThirdDeliveryPersonDTO orderThirdDeliveryPersonDTO = new OrderThirdDeliveryPersonDTO();
        orderThirdDeliveryPersonDTO.setName(deliveryOrgInfoDTO.getContactName());
        orderThirdDeliveryPersonDTO.setTel(deliveryOrgInfoDTO.getTel());
        orderThirdDeliveryPersonDTO.setMobile(deliveryOrgInfoDTO.getContactPhone());
        orderThirdDeliveryPersonDTO.setCompany(deliveryOrgInfoDTO.getName());
//        orderThirdDeliveryPersonDTO.setPostCode();
        orderThirdDeliveryPersonDTO.setProvince(deliveryOrgInfoDTO.getProvince());
        orderThirdDeliveryPersonDTO.setCity(deliveryOrgInfoDTO.getCity());
        orderThirdDeliveryPersonDTO.setArea(deliveryOrgInfoDTO.getArea());
        orderThirdDeliveryPersonDTO.setAddress(deliveryOrgInfoDTO.getAddress()+deliveryOrgInfoDTO.getAddressDetail());
        return orderThirdDeliveryPersonDTO;
    }
}
