package org.dromara.main.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

/**
 * 提现配置
 */
@Data
@Component
@ConfigurationProperties(prefix = "withdraw")
public class WithdrawConfig {

    /**
     * 审核模式：auto=自动审核，manual=人工审核
     */
    private String auditMode = "manual";

    /**
     * 自动审核规则
     */
    private AutoAuditRule autoAuditRule = new AutoAuditRule();

    @Data
    public static class AutoAuditRule {
        /**
         * 单笔最大自动审核金额
         */
        private BigDecimal maxAmount = new BigDecimal("10000");

        /**
         * 单日最大提现次数
         */
        private Integer maxDailyCount = 10;

        /**
         * 单日最大提现总额
         */
        private BigDecimal maxDailyAmount = new BigDecimal("50000");
    }

    public boolean isAutoAudit() {
        return "auto".equalsIgnoreCase(auditMode);
    }
}
