package cn.iocoder.yudao.module.order.vo.orderSplitItem;

import com.alibaba.fastjson.JSONObject;
import lombok.*;

import java.math.BigDecimal;
import java.util.*;
import io.swagger.annotations.*;
import com.alibaba.excel.annotation.ExcelProperty;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;

import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

/**
* 订单拆单产品项 Response VO
* @author yanghao
*/
@Data
@ApiModel("管理后台 - 订单拆单产品项 Response VO")
public class OrderSplitItemBackVO {

    @ExcelProperty("主键ID")
    @ApiModelProperty(value = "主键ID", required = true)
    private Long id;

    @ExcelProperty("创建时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    @ApiModelProperty(value = "创建时间", required = true)
    private Date createTime;

    @ExcelProperty("拆单id")
    @ApiModelProperty(value = "拆单id")
    private Long orderSplitId;

    @ExcelProperty("订单项id")
    @ApiModelProperty(value = "订单项id")
    private Long orderItemId;

    @ExcelProperty("商品ID")
    @ApiModelProperty(value = "商品ID", required = true)
    private Long prodId;

    @ExcelProperty("产品类型")
    @ApiModelProperty(value = "产品类型")
    private Integer prodType;

    @ExcelProperty("产品中文标题")
    @ApiModelProperty(value = "产品中文标题")
    private String prodTitleZh;

    @ExcelProperty("产品英文标题")
    @ApiModelProperty(value = "产品英文标题")
    private String prodTitleEn;

    @ExcelProperty("品牌")
    @ApiModelProperty(value = "品牌")
    private String brand;

    @ExcelProperty("品牌名")
    @ApiModelProperty(value = "品牌名")
    private String brandName;

    @ExcelProperty("0 无牌 1 有牌 2 中性")
    @ApiModelProperty(value = "0 无牌 1 有牌 2 中性", required = true)
    private Integer brandType;

    /**
     * 费用模式：无牌价0，有牌价1，中性品牌价2
     */
    @ExcelProperty("0 无牌价 1 有牌价 2 中性价")
    @ApiModelProperty(value = "费用模式：无牌价0，有牌价1，中性品牌价2")
    private Integer feeType;

    @ExcelProperty("件数")
    @ApiModelProperty(value = "件数")
    private Integer num;

    @ExcelProperty("数量")
    @ApiModelProperty(value = "数量")
    private Integer quantity;

    @ExcelProperty("单位")
    @ApiModelProperty(value = "单位")
    private String unit;

    @ExcelProperty("箱规")
    @ApiModelProperty(value = "箱规")
    private String boxGauge;

    @ExcelProperty("体积")
    @ApiModelProperty(value = "体积")
    private BigDecimal volume;

    @ExcelProperty("重量")
    @ApiModelProperty(value = "重量")
    private BigDecimal weight;

    @ApiModelProperty(value = "收费重量")
    private BigDecimal chargeWeight;

    @ApiModelProperty(value = "收费体积")
    private BigDecimal chargeVolume;

    @ApiModelProperty(value = "收费个数")
    private BigDecimal chargeQuantity;

    @ApiModelProperty(value = "货值")
    private BigDecimal worth;

    @ApiModelProperty(value = "是否拆单自定义价格")
    private Boolean splitCustomPriceType;

    @ApiModelProperty(value = "原运费成交单价")
    private BigDecimal orgOneSeaFreight = BigDecimal.ZERO;

    @ApiModelProperty(value = "原运费货币单位ID")
    private Integer orgSeaFreightCurrency;

    @ApiModelProperty(value = "原运费计量单位")
    private Long orgSeaFreightVolume;

    @ApiModelProperty(value = "原清关费单价(成交)")
    private BigDecimal orgOneClearanceFreight = BigDecimal.ZERO;

    @ApiModelProperty(value = "原清关费货币单位ID")
    private Integer orgClearanceFreightCurrency;

    @ApiModelProperty(value = "原清关费计量单位")
    private Long orgClearanceFreightVolume;

    @ApiModelProperty(value = "原计费方式：0 运费/清关费 1 全包价")
    private Integer orgCharging;

    @ApiModelProperty(value = "运费成交单价")
    private BigDecimal oneSeaFreight = BigDecimal.ZERO;

    @ApiModelProperty(value = "运费货币单位ID")
    private Integer seaFreightCurrency;

    @ApiModelProperty(value = "运费计量单位")
    private Long seaFreightVolume;

    @ApiModelProperty(value = "清关费单价(成交)")
    private BigDecimal oneClearanceFreight = BigDecimal.ZERO;

    @ApiModelProperty(value = "清关费货币单位ID")
    private Integer clearanceFreightCurrency;

    @ApiModelProperty(value = "清关费计量单位")
    private Long clearanceFreightVolume;

    @ApiModelProperty(value = "计费方式：0 运费/清关费 1 全包价")
    private Integer charging;

    /**
     * 规格记录
     */
    private String specsRecord;

    @ApiModelProperty(value = "规格记录")
    private List<OrderSpiltItemSpecsRecordVO> specsRecordVOList;

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

    public void setSpecsRecord(String specsRecord) {
        this.specsRecord = specsRecord;
        if (StringUtils.isNotBlank(specsRecord)){
            this.specsRecordVOList = JSONObject.parseArray(specsRecord, OrderSpiltItemSpecsRecordVO.class);
        }
    }
}
