package com.ruoyi.xq.enums.common;

import com.ruoyi.xq.manager.systemconfig.BooleanSystemConfigCheck;
import com.ruoyi.xq.manager.systemconfig.ISystemConfigCheck;
import com.ruoyi.xq.manager.systemconfig.RateSystemConfigCheck;
import lombok.Getter;
import lombok.Setter;

/**
 * 系统动态配置枚举
 * <p>created on 2022/8/18 17:15</p>
 *
 * @author ZL
 */
public enum SystemConfigEnum {
    // TODO 限制为两位小数
    WX_TRANS_PRICE("0.01", "微信交换次数价格", SystemConfigGroupEnum.BUSINESS, null),
    OPEN_WX_WITHDRAW("0", "是否开启微信提现", SystemConfigGroupEnum.BUSINESS, null),
    OPEN_ALI_WITHDRAW("1", "是否开启支付宝提现", SystemConfigGroupEnum.BUSINESS, null),
    VIP_INVITE_RATE("0.30","默认会员分销比例",SystemConfigGroupEnum.BUSINESS, new RateSystemConfigCheck()),
    CUSTOMER_SERVICE_URL("https://xq-oss-123121.oss-cn-guangzhou.aliyuncs.com/xq/images/service/customer-service.png","客服地址",SystemConfigGroupEnum.BUSINESS, null),
    SENSITIVE_ENABLE("1", "是否开启手机号脱敏",SystemConfigGroupEnum.SYSTEM,new BooleanSystemConfigCheck()),
    SMS_CODE_ADMIN("", "万能验证码",SystemConfigGroupEnum.SYSTEM),
    PASSWORD_ADMIN("", "公用密码",SystemConfigGroupEnum.SYSTEM),
    COS_DOMAIN("http://nono-1257812345.cos.ap-shanghai.myqcloud.com/", "文件系统域名前缀",SystemConfigGroupEnum.SYSTEM),
    ;


    @Getter
    private final String defaultValue;
    @Getter
    private final String desc;
    @Getter
    private final SystemConfigGroupEnum group;
    @Setter
    @Getter
    private ISystemConfigCheck check = null;

    SystemConfigEnum(String defaultValue, String desc, SystemConfigGroupEnum group) {
        this.defaultValue = defaultValue;
        this.desc = desc;
        this.group = group;
    }

    SystemConfigEnum(String defaultValue, String desc, SystemConfigGroupEnum group, ISystemConfigCheck check) {
        this.defaultValue = defaultValue;
        this.desc = desc;
        this.group = group;
        this.check = check;
    }

    public String getKey() {
        return this.name();
    }
}
