package com.gic.haoban.manage.api.dto.contact;

import cn.hutool.core.util.NumberUtil;

import java.io.Serializable;
import java.math.RoundingMode;

public class ContactOrderGoodsInfoDTO implements Serializable {
    private static final long serialVersionUID = 973688857967269975L;

    /**
     * 商品ID
     */
    private String goodsId;

    /**
     * 商品图片
     */
    private String imageUrl;

    /**
     * 商品数量
     */
    private Integer number;

    /**
     * 应收
     */
    private Double paidAmount;

    /**
     * 实付
     */
    private Double payAmount;

    /**
     * 吊牌价
     */
    private Double unitPrice;

    /**
     * 折扣 = 实付/吊牌价
     *
     */
    private Double discount;

    /**
     * 商品名称
     */
    private String proName;

    /**
     * 商品编号
     */
    private String proNo;

    /**
     * 商品类型
     */
    private Integer proType;

    /**
     * 商品规格编码
     */
    private String skuCode;

    /**
     * 商品规格属性
     */
    private String attribute;

    public String getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(String goodsId) {
        this.goodsId = goodsId;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    public Double getPaidAmount() {
        return paidAmount;
    }

    public void setPaidAmount(Double paidAmount) {
        this.paidAmount = paidAmount;
    }

    public Double getPayAmount() {
        return payAmount;
    }

    public void setPayAmount(Double payAmount) {
        this.payAmount = payAmount;
    }

    public Double getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(Double unitPrice) {
        this.unitPrice = unitPrice;
    }

    public Double getDiscount() {
        if (unitPrice != null && payAmount != null) {
            if (unitPrice == 0) {
                return 1.0;
            }
            return NumberUtil.div(payAmount * 1.0, unitPrice.doubleValue(), 2, RoundingMode.HALF_UP);
        }
        return discount;
    }

    public void setDiscount(Double discount) {
        this.discount = discount;
    }

    public String getProName() {
        return proName;
    }

    public void setProName(String proName) {
        this.proName = proName;
    }

    public String getProNo() {
        return proNo;
    }

    public void setProNo(String proNo) {
        this.proNo = proNo;
    }

    public Integer getProType() {
        return proType;
    }

    public void setProType(Integer proType) {
        this.proType = proType;
    }

    public String getSkuCode() {
        return skuCode;
    }

    public void setSkuCode(String skuCode) {
        this.skuCode = skuCode;
    }

    public String getAttribute() {
        return attribute;
    }

    public void setAttribute(String attribute) {
        this.attribute = attribute;
    }
}