package com.ruoyi.dashboard.domain.revenueStat;

import java.math.BigDecimal;
import java.util.Map;

import com.ruoyi.bst.order.domain.enums.OrderStatus;
import com.ruoyi.common.utils.MathUtils;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
public class RevenueStatVO {

    @ApiModelProperty("订单用户数量")
    private Integer orderUserCount;
    @ApiModelProperty("订单实收金额（不含退款）")
    private BigDecimal orderActualAmount;
    @ApiModelProperty("订单实收金额（含退款）")
    public BigDecimal getOrderActualReceivedAmount() {
        return MathUtils.subtractDecimal(orderActualAmount, orderAdminRefundAmount);
    }

    @ApiModelProperty("订单骑行费")
    private BigDecimal orderRiddingFee;
    @ApiModelProperty("订单车损费")
    private BigDecimal orderDeductionFee;
    @ApiModelProperty("订单调度费")
    private BigDecimal orderDispatchFee;
    @ApiModelProperty("订单管理费")
    private BigDecimal orderManageFee;
    @ApiModelProperty("订单总数量")
    private Integer orderCount;
    @ApiModelProperty("订单自动退款金额")
    private BigDecimal orderAutoRefundAmount;
    @ApiModelProperty("订单人工退款金额")
    private BigDecimal orderAdminRefundAmount;
    @ApiModelProperty("订单状态数量（创建时间）")
    private Map<String, Integer> orderStatusMap;
    @ApiModelProperty("订单状态数量（完成时间）")
    private Map<String, Integer> orderEndStatusMap;
    @ApiModelProperty("已完成的订单")
    public Integer getFinishedOrderCount() {
        if (orderEndStatusMap == null) {
            return 0;
        }
        int count = 0;
        for (String status : OrderStatus.finishedList()) {
            count += MathUtils.dv(orderEndStatusMap.get(status));
        }
        return count;
    }

    @ApiModelProperty("分成总金额")
    private BigDecimal bonusAmount;
    @ApiModelProperty("分成退款金额")
    private BigDecimal bonusRefundAmount;
    @ApiModelProperty("分成待分金额")
    private BigDecimal bonusWaitDivideAmount;
    @ApiModelProperty("分成数量")
    private Integer bonusCount;
    @ApiModelProperty("分成实收金额")
    public BigDecimal getBonusActualAmount() {
        return MathUtils.subtractDecimal(bonusAmount, bonusRefundAmount);
    }

    @ApiModelProperty("平台分成金额")
    private BigDecimal platformBonusAmount;
    @ApiModelProperty("平台分成退款金额")
    private BigDecimal platformBonusRefundAmount;
    @ApiModelProperty("平台分成实收金额")
    public BigDecimal getPlatformBonusActualAmount() {
        return MathUtils.subtractDecimal(platformBonusAmount, platformBonusRefundAmount);
    }

    @ApiModelProperty("运营区数量")
    private Integer areaCount;
    @ApiModelProperty("运营区加盟数量")
    private Integer areaJoinCount;
    @ApiModelProperty("运营区合伙数量")
    private Integer areaPartnerCount;
    @ApiModelProperty("运营区运维数量")
    private Integer areaOperationCount;

    @ApiModelProperty("设备数量")
    private Integer deviceCount;
    @ApiModelProperty("设备状态数量")
    private Map<String, Integer> deviceStatusMap;
    @ApiModelProperty("设备在线数量")
    private Map<String, Integer> deviceOnlineStatusMap;

    @ApiModelProperty("成功提现金额")
    private BigDecimal withdrawSuccessAmount;
    @ApiModelProperty("待审核的提现数量")
    private Integer withdrawWaitVerifyCount;
    @ApiModelProperty("提现手续费")
    private BigDecimal withdrawServiceCharge;

    @ApiModelProperty("待审核的加盟商申请数量")
    private Integer mchApplyApprovingCount;

    @ApiModelProperty("待处理的故障数量")
    private Integer faultPendingCount;

    @ApiModelProperty("用户余额")
    private BigDecimal userBalance;
    @ApiModelProperty("运营商数量")
    private Integer userMchCount;
    @ApiModelProperty("用户数量")
    private Integer userCount;

    @ApiModelProperty("车型数量")
    private Integer modelCount;
}
