package com.ycwl.basic.model.mobile.statistic.resp;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * @Author：longbinbin
 * @Date：2024/12/12 16:24
 */
@Data
// 移动端用户转化漏斗
public class AppStatisticsFunnelVO {

    // 镜头检测游客数
    private int cameraShotOfMemberNum; // cs1
    // 扫码访问人数
    private int scanCodeVisitorOfMemberNum; // sv1
    // 上传头像（人脸）人数
    private int uploadFaceOfMemberNum; // u1
    // 推送订阅人数
    private int pushOfMemberNum; // m1
    // 生成视频人数
    private int completeVideoOfMemberNum; // gv1
    // 预览视频人数
    private int previewVideoOfMemberNum; // pv1
    // 点击购买人数
    private int clickOnPayOfMemberNum; // cp1
    // 支付订单人数
    private int payOfMemberNum; // p1

    // 总访问人数
    private int totalVisitorOfMemberNum; // v1
    // 生成视频条数
    private int completeOfVideoNum; // gv2
    // 预览视频条数
    private int previewOfVideoNum; // pv2
    // 支付订单数
    private int payOfOrderNum; // p2
    // 支付订单金额
    private BigDecimal payOfOrderAmount; // o3
    // 退款订单数
    private int refundOfOrderNum; // ro2
    // 退款订单金额
    private BigDecimal refundOfOrderAmount; // ro3

    // 镜头检测游客数_扫码访问人数_转化率
    @JsonProperty("csom_scaom")
    public String getCsom_scaom() {
        return "-"; // TODO: REAL
    }

    // 扫码访问人数_推送订阅人数_转化率
    @JsonProperty("scaom_ufom")
    public String getScaom_ufom() {
        if (scanCodeVisitorOfMemberNum == 0 || pushOfMemberNum == 0) {
            return "0.00";
        }
        return new BigDecimal(pushOfMemberNum)
                .multiply(new BigDecimal(100))
                .divide(new BigDecimal(scanCodeVisitorOfMemberNum), 2, RoundingMode.HALF_UP)
                .toString();
    }
    // 推送订阅人数_上传头像人数_转化率
    @JsonProperty("ufom_pom")
    public String getUfom_pom() {
        if (pushOfMemberNum == 0 || uploadFaceOfMemberNum == 0) {
            return "0.00";
        }
        return new BigDecimal(uploadFaceOfMemberNum)
                .multiply(new BigDecimal(100))
                .divide(new BigDecimal(pushOfMemberNum), 2, RoundingMode.HALF_UP)
                .toString();
    }
    // 上传头像人数_生成视频人数_转化率
    @JsonProperty("pom_cvom")
    public String getPom_cvom() {
        if (uploadFaceOfMemberNum == 0 || completeVideoOfMemberNum == 0) {
            return "0.00";
        }
        return new BigDecimal(completeVideoOfMemberNum)
                .multiply(new BigDecimal(100))
                .divide(new BigDecimal(uploadFaceOfMemberNum), 2, RoundingMode.HALF_UP)
                .toString();
    }
    // 生成视频人数_预览视频人数_转化率
    @JsonProperty("cvom_pvom")
    public String getCvom_pvom() {
        if (previewVideoOfMemberNum == 0 || completeVideoOfMemberNum == 0) {
            return "0.00";
        }
        return new BigDecimal(previewVideoOfMemberNum)
                .multiply(new BigDecimal(100))
                .divide(new BigDecimal(completeVideoOfMemberNum), 2, RoundingMode.HALF_UP)
                .toString();
    }
    // 预览视频人数_点击购买人数_转化率
    @JsonProperty("pvom_cpom")
    public String getPvom_cpom() {
        if (clickOnPayOfMemberNum == 0 || previewVideoOfMemberNum == 0) {
            return "0.00";
        }
        return new BigDecimal(clickOnPayOfMemberNum)
                .multiply(new BigDecimal(100))
                .divide(new BigDecimal(previewVideoOfMemberNum), 2, RoundingMode.HALF_UP)
                .toString();
    }
    // 点击购买人数_支付订单人数_转化率
    @JsonProperty("cpom_pom")
    public String getCpom_pom() {
        if (payOfMemberNum == 0 || clickOnPayOfMemberNum == 0) {
            return "0.00";
        }
        return new BigDecimal(payOfMemberNum)
                .multiply(new BigDecimal(100))
                .divide(new BigDecimal(clickOnPayOfMemberNum), 2, RoundingMode.HALF_UP)
                .toString();
    }
    public BigDecimal payOfOrderAmount() {
        return payOfOrderAmount;
    }
    @JsonProperty("payOfOrderAmount")
    public String getPayOfOrderAmount() {
        if (payOfOrderAmount == null) {
            return "0.00";
        }
        return payOfOrderAmount.toString();
    }
    public BigDecimal refundOfOrderAmount() {
        return refundOfOrderAmount;
    }
    @JsonProperty("refundOfOrderAmount")
    public String getRefundOfOrderAmount() {
        if (refundOfOrderAmount == null) {
            return "0.00";
        }
        return refundOfOrderAmount.toString();
    }
}
