package com.ycwl.basic.profitsharing.entity;

import com.alibaba.fastjson.JSON;
import com.ycwl.basic.profitsharing.enums.ProfitSharingWxPayType;
import lombok.Data;

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

@Data
public class ProfitSharingUser {
    private Long id;
    private Long configId;
    private ProfitSharingWxPayType wxPayType;
    private Map<String, String> wxPayConfig;
    private String name;
    private String description;
    /**
     * 分账比例模式，0：剩余模式，1：固定比例，2：扣除固定抽成后的动态比例，3：固定抽成，4：扣除其他所有类型抽成后的动态比例
     */
    private Integer rateMode;
    /**
     * 微信分账比例，单位为%
     */
    private BigDecimal wxRate;
    /**
     * 实际分账比例，单位为%
     */
    private BigDecimal realRate;

    public void setWxPayConfig(String wxPayConfig) {
        this.wxPayConfig = JSON.parseObject(wxPayConfig, Map.class);
    }

    public String getWxPayConfig() {
        return JSON.toJSONString(wxPayConfig);
    }
}