package com.config;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 应用配置属性 - 替代静态 AppConfig
 * 使用 Spring Boot 标准 @Value 机制，支持 docker-compose 环境变量覆盖
 */
@Data
@Component
public class AppProperties {

    // ========== Syslog 配置 ==========
    @Value("${syslog.tcp.port:514}")
    private int syslogTcpPort;

    @Value("${syslog.udp.port:515}")
    private int syslogUdpPort;

    @Value("${syslog.max.frame.length:65536}")
    private int syslogMaxFrameLength;

    @Value("${syslog.buffer.size:1024}")
    private int syslogBufferSize;

    // ========== InfluxDB 配置 ==========
    @Value("${influxdb.url:http://localhost:8086}")
    private String influxUrl;

    @Value("${influxdb.token:}")
    private String influxToken;

    @Value("${influxdb.org:}")
    private String influxOrg;

    @Value("${influxdb.bucket:syslog}")
    private String influxBucket;

    @Value("${influxdb.batch.size:1000}")
    private int influxBatchSize;

    @Value("${influxdb.flush.interval:1000}")
    private int influxFlushInterval;

    @Value("${influxdb.retry.attempts:3}")
    private int influxRetryAttempts;

    @Value("${influxdb.retry.delay:100}")
    private int influxRetryDelay;

    // ========== 应用配置 ==========
    @Value("${app.worker.threads:4}")
    private int workerThreads;

    @Value("${app.max.queue.size:2000}")
    private int maxQueueSize;

    @Value("${app.metrics.enabled:false}")
    private boolean metricsEnabled;

    // ========== 运行环境 ==========
    @Value("${server.run.environment:prod}")
    private String runEnvironment;

    // ========== SM4 加密配置 ==========
    @Value("${syslog.sm4.generateKey:}")
    private String sm4Key;
}
