package com.haobang.config;

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

/**
 * 应用配置属性 - 替代静态 AppConfig（syslog-serve 模块）
 * 使用 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;

    @Value("${syslog.charset:GBK}")
    private String syslogCharset;

    // ========== App Service 配置（探针设备信息）==========
    @Value("${app.service.device_id:}")
    private String appServiceDeviceId;

    @Value("${app.service.device_name:}")
    private String appServiceDeviceName;

    @Value("${app.service.vendor:}")
    private String appServiceVendor;

    @Value("${app.service.product_name:}")
    private String appServiceProductName;

    @Value("${app.service.data_type:json}")
    private String appServiceDataType;

    @Value("${app.service.device_collect_id:1}")
    private int appServiceDeviceCollectId;

    // ========== Kafka Producer 配置 ==========
    @Value("${spring.kafka.producer.bootstrap-servers:localhost:9092}")
    private String kafkaProducerBootstrap;

    @Value("${spring.kafka.producer.topic:agent-syslog-topic}")
    private String kafkaProducerTopic;

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