package com.lingniu.ingest.inbound.xinda.config;

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

import java.util.ArrayList;
import java.util.List;

/**
 * 信达 Push 接入配置。所有敏感字段均可通过环境变量注入，彻底取代旧代码里的硬编码。
 *
 * <p>该入口属于第三方推送协议，与 GB32960 TCP 接收链路并列。生产排查 32960 时，
 * 应先确认本开关是否关闭，避免把信达推送事件误认为 32960 原始包。
 */
@ConfigurationProperties(prefix = "lingniu.ingest.xinda-push")
public class XindaPushProperties {

    /** 总开关。关闭时不会向信达平台建连/订阅。 */
    private boolean enabled = false;
    private String host;
    private int port = 10100;
    private String username;
    private String password;
    private String clientDesc = "lingniu-ingest";
    /** 默认订阅常见定位/轨迹类消息，新增业务消息需要先在 mapper 中确认字段映射。 */
    private List<String> subscribeMsgIds = new ArrayList<>(List.of("0200", "0300", "0401"));
    /** 断线重连间隔（秒）。 */
    private int reconnectIntervalSec = 5;

    public boolean isEnabled() { return enabled; }
    public void setEnabled(boolean enabled) { this.enabled = enabled; }
    public String getHost() { return host; }
    public void setHost(String host) { this.host = host; }
    public int getPort() { return port; }
    public void setPort(int port) { this.port = port; }
    public String getUsername() { return username; }
    public void setUsername(String username) { this.username = username; }
    public String getPassword() { return password; }
    public void setPassword(String password) { this.password = password; }
    public String getClientDesc() { return clientDesc; }
    public void setClientDesc(String clientDesc) { this.clientDesc = clientDesc; }
    public List<String> getSubscribeMsgIds() { return subscribeMsgIds; }
    public void setSubscribeMsgIds(List<String> subscribeMsgIds) { this.subscribeMsgIds = subscribeMsgIds; }
    public int getReconnectIntervalSec() { return reconnectIntervalSec; }
    public void setReconnectIntervalSec(int reconnectIntervalSec) { this.reconnectIntervalSec = reconnectIntervalSec; }
}
