package com.ruoyi.ss.transactionBill.domain.vo;

import com.fasterxml.jackson.annotation.JsonView;
import com.ruoyi.common.annotation.Sensitive;
import com.ruoyi.common.core.domain.JsonViewProfile;
import com.ruoyi.common.enums.DesensitizedType;
import com.ruoyi.ss.bonus.domain.Bonus;
import com.ruoyi.ss.bonus.domain.BonusVO;
import com.ruoyi.iot.interfaces.IotDevice;
import com.ruoyi.ss.suit.domain.enums.SuitFeeMode;
import com.ruoyi.ss.suit.domain.enums.SuitFeeType;
import com.ruoyi.ss.suit.domain.enums.SuitTimeUnit;
import com.ruoyi.ss.transactionBill.domain.TransactionBill;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author 辉
 * 2024/3/4
 */
@ApiModel
@Data
public class TransactionBillVO extends TransactionBill implements IotDevice {
    @ApiModelProperty("用户名称")
    @JsonView(JsonViewProfile.App.class)
    @Sensitive(desensitizedType = DesensitizedType.USERNAME)
    private String userName;

    @ApiModelProperty("商户（到账用户）名称")
    @JsonView(JsonViewProfile.App.class)
    @Sensitive(desensitizedType = DesensitizedType.COMMON)
    private String mchName;

    @ApiModelProperty("支付渠道名称")
    @JsonView(JsonViewProfile.App.class)
    private String channelName;

    @ApiModelProperty("商户手机号")
    @JsonView(JsonViewProfile.App.class)
    private String mchMobile;

    @ApiModelProperty("设备总用电量")
    @JsonView(JsonViewProfile.App.class)
    private BigDecimal deviceTotalEle;

    @ApiModelProperty("设备结束时间")
    @JsonView(JsonViewProfile.App.class)
    private LocalDateTime deviceExpireTime;

    @ApiModelProperty("是否使用中")
    @JsonView(JsonViewProfile.App.class)
    private Boolean isUsing;

    @ApiModelProperty("是否已经结束使用")
    @JsonView(JsonViewProfile.App.class)
    private Boolean isFinished;

    @ApiModelProperty("套餐剩余时长（秒）/电量（度）")
    @JsonView(JsonViewProfile.App.class)
    private BigDecimal suitSurplus;

    @ApiModelProperty("分成列表")
    private List<BonusVO> bonusList;

    @ApiModelProperty("总用电量（度）/时长（秒）")
    private BigDecimal totalUse;

    @ApiModelProperty("操作权限")
    @JsonView(JsonViewProfile.App.class)
    private TransactionBillOperatorVO operator;

    @Override
    public String iotMac1() {
        return getDeviceMac();
    }

    @Override
    public String iotMac2() {
        return getDeviceMac2();
    }

    @Override
    public String getProductId() {
        return getDeviceProductId();
    }
}
