package com.gic.haoban.manage.web.vo.content.statistics.bo;

import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Optional;

/**
 * @Author MUSI
 * @Date 2023/3/27 1:02 PM
 * @Description
 * @Version
 **/
@Data
public class MaterialTodayDataBO implements Serializable {

    /**
     * 使用导购数
     */
    private Integer useMatlClerkNum;

    /**
     * 未使用导购数
     */
    private Integer unusedMatlClerkNum;

    /**
     * 点击客户数
     */
    private Integer clickUserNum;

    /**
     * 转化人数
     */
    private Integer convUserNum;
    /**
     * 转化金额
     */
    private BigDecimal convSalesAmt;

    /**
     * 线下转化客户数
     */
    private Integer offlineConvUserNum;

    /**
     * 线下转化金额
     */
    private BigDecimal offlineConvSalesAmt;


    /**
     * 总转化金额
     */
    private BigDecimal omniConvSalesAmt;

    /**
     * 总转化人数
     */
    private Integer omniConvUserNum;

    public BigDecimal getOmniConvSalesAmt() {
        if (this.omniConvSalesAmt != null) {
            return this.omniConvSalesAmt;
        }
        return Optional.ofNullable(this.convSalesAmt).orElse(BigDecimal.ZERO).add(Optional.ofNullable(this.offlineConvSalesAmt).orElse(BigDecimal.ZERO));
    }

    public Integer getOmniConvUserNum() {
        if (this.omniConvUserNum != null) {
            return omniConvUserNum;
        }
        return Optional.ofNullable(this.convUserNum).orElse(0) + Optional.ofNullable(this.offlineConvUserNum).orElse(0);
    }

    public static MaterialTodayDataBO empty(){
        return new MaterialTodayDataBO();
    }
}
