package com.tzld.piaoquan.ad.engine.server.config;

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

/**
 * Eureka覆盖状态配置
 */
@Component
@ConfigurationProperties(prefix = "eureka.override.status")
public class EurekaOverrideStatusConfig {

    /**
     * 是否启用覆盖状态移除功能
     */
    private boolean removalEnabled = true;

    /**
     * 移除覆盖状态后等待时间（毫秒）
     */
    private long waitTimeAfterRemoval = 1000L;

    /**
     * 是否在启动时打印详细日志
     */
    private boolean verboseLogging = true;

    /**
     * 初始延迟时间（毫秒）- 确保Eureka客户端完全初始化
     */
    private long initialDelay = 5000L;

    /**
     * 最大重试次数
     */
    private int maxRetries = 3;

    /**
     * 重试间隔时间（毫秒）
     */
    private long retryInterval = 2000L;

    /**
     * Eureka服务器URL（可选，如果不配置会尝试自动获取）
     */
    private String eurekaServerUrl;

    /**
     * 飞书报警URL（配置为ad.platform.feishu.alert.server-up对应的webhook地址）
     */
    private String feishuAlertUrl;

    /**
     * 飞书消息格式类型（text: 纯文本, card: 富文本卡片）
     */
    private String feishuMessageType = "card";

    public boolean isRemovalEnabled() {
        return removalEnabled;
    }

    public void setRemovalEnabled(boolean removalEnabled) {
        this.removalEnabled = removalEnabled;
    }

    public long getWaitTimeAfterRemoval() {
        return waitTimeAfterRemoval;
    }

    public void setWaitTimeAfterRemoval(long waitTimeAfterRemoval) {
        this.waitTimeAfterRemoval = waitTimeAfterRemoval;
    }

    public boolean isVerboseLogging() {
        return verboseLogging;
    }

    public void setVerboseLogging(boolean verboseLogging) {
        this.verboseLogging = verboseLogging;
    }

    public long getInitialDelay() {
        return initialDelay;
    }

    public void setInitialDelay(long initialDelay) {
        this.initialDelay = initialDelay;
    }

    public int getMaxRetries() {
        return maxRetries;
    }

    public void setMaxRetries(int maxRetries) {
        this.maxRetries = maxRetries;
    }

    public long getRetryInterval() {
        return retryInterval;
    }

    public void setRetryInterval(long retryInterval) {
        this.retryInterval = retryInterval;
    }

    public String getEurekaServerUrl() {
        return eurekaServerUrl;
    }

    public void setEurekaServerUrl(String eurekaServerUrl) {
        this.eurekaServerUrl = eurekaServerUrl;
    }

    public String getFeishuAlertUrl() {
        return feishuAlertUrl;
    }

    public void setFeishuAlertUrl(String feishuAlertUrl) {
        this.feishuAlertUrl = feishuAlertUrl;
    }

    public String getFeishuMessageType() {
        return feishuMessageType;
    }

    public void setFeishuMessageType(String feishuMessageType) {
        this.feishuMessageType = feishuMessageType;
    }
}
