package com.ruoyi.system.domain.enums.config;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 配置项枚举
 * @author wjh
 * 2024/3/26
 */
@AllArgsConstructor
@Getter
public enum ConfigKey {

    SERVICE_FEE_RATE("sm.transactionBill.serviceFee", "充值服务费费率"),
    WITHDRAW_SERVICE_FEE_RATE("sm.transactionBill.widthDraw.serviceFee", "提现服务费费率"),
    WECHAT_APPROVAL("sys.wechat.approval", "微信小程序敏感内容展示"),
    DAILY_WITHDRAW_AMOUNT("daily.withdraw.amount", "单日单用户提现限额（元）"),
    DAILY_WITHDRAW_COUNT("daily.withdraw.count", "单日单用户提现次数（次）"),
    NOVERIFY_WITHDRAW_SINGLE("noverify.withdraw.single", "提现单笔免审核额度（元）"),
    RECHARGE_MIN_SERVICE("recharge.min.service","充值最低服务费（元）"),
    ARRIVAL_DELAY("arrival.delay", "延迟到账时间（小时）"),
    ORDER_AUTO_CLOSE_CD("order.auto.close.cd", "订单自动关闭冷却时间（分）"),
    RISK_WITHDRAW_TIME("risk.withdraw.time", "风控订单和提现相隔时长（分钟）"),
    RISK_WITHDRAW_COUNT("risk.withdraw.count", "累计风险次数"),
    RISK_WITHDRAW_ENABLED("risk.withdraw.enabled", "是否开启提现风控"),
    LOGIN_WITH_PHONE("login.with.phone", "登录是否需要手机号");

    private final String key;
    private final String msg;

    public static ConfigKey parse(String key) {
        for (ConfigKey obj : ConfigKey.values()) {
            if (Objects.equals(obj.getKey(), key)) {
                return obj;
            }
        }
        throw new RuntimeException("不存在值为" + key + "的配置项");
    }
}
