package com.ycwl.basic.model.mobile.order;

import lombok.Data;

import java.math.BigDecimal;

@Data
public class IsBuyBatchRespVO {
    private boolean buy;
    private boolean free;
    private Long orderId;
    private Integer configId;
    private int type;
    private String goodsIds;
    private BigDecimal origPrice = BigDecimal.ZERO;
    private Integer couponId;
    private Integer couponRecordId;
    private BigDecimal couponPrice = BigDecimal.ZERO;
    private BigDecimal slashPrice;

    public BigDecimal getPrice() {
        if (origPrice == null) {
            return BigDecimal.ZERO;
        }
        if (couponPrice == null) {
            return origPrice;
        }
        return origPrice.subtract(couponPrice);
    }
    public BigDecimal getDiscountPrice() {
        if (slashPrice == null) {
            return BigDecimal.ZERO;
        }
        if (slashPrice.compareTo(BigDecimal.ZERO) <= 0) {
            return BigDecimal.ZERO;
        }
        return slashPrice.subtract(origPrice);
    }
}
