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

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.math.RoundingMode;

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

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

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

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

    @ApiModelProperty("扫码访问人数_上传头像人数_转化率")
    public String getScaom_ufom() {
        if (uploadFaceOfMemberNum == 0 || scanCodeVisitorOfMemberNum == 0) {
            return "0.00";
        }
        return new BigDecimal(uploadFaceOfMemberNum)
                .multiply(new BigDecimal(100))
                .divide(new BigDecimal(scanCodeVisitorOfMemberNum), 2, RoundingMode.HALF_UP)
                .toString();
    }
    @ApiModelProperty("上传头像人数_推送订阅人数_转化率")
    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();
    }
    @ApiModelProperty("推送订阅人数_生成视频人数_转化率")
    public String getPom_cvom() {
        if (completeVideoOfMemberNum == 0 || pushOfMemberNum == 0) {
            return "0.00";
        }
        return new BigDecimal(completeVideoOfMemberNum)
                .multiply(new BigDecimal(100))
                .divide(new BigDecimal(pushOfMemberNum), 2, RoundingMode.HALF_UP)
                .toString();
    }
    @ApiModelProperty("生成视频人数_预览视频人数_转化率")
    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();
    }
    @ApiModelProperty("预览视频人数_点击购买人数_转化率")
    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();
    }
    @ApiModelProperty("点击购买人数_支付订单人数_转化率")
    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 String getPayOfOrderAmount() {
        return payOfOrderAmount.toString();
    }
    public String getRefundOfOrderAmount() {
        return refundOfOrderAmount.toString();
    }
}
