# External Client Adapter Configuration
adapter:
  # 是否启用外部客户端适配器
  enabled: true
  
  # 监听端口（如果使用独立服务）
  port: 8081
  
  # 消息队列配置
  message_queue:
    enabled: false
    type: "redis"  # redis, rabbitmq, kafka
    host: "localhost"
    port: 6379
    password: ""
    database: 0
  
  # 安全配置
  security:
    # 是否启用API密钥认证
    enable_api_key: false
    # 允许的API密钥列表
    allowed_api_keys: []
    # 是否启用IP白名单
    enable_ip_whitelist: false
    # 允许的IP地址列表
    allowed_ips: []
  
  # 限流配置
  rate_limit:
    enabled: true
    requests_per_minute: 100
    burst_size: 20
  
  # 日志配置
  logging:
    level: "info"
    enable_request_log: true
    enable_response_log: true
  
  # 超时配置
  timeout:
    request_timeout: "30s"
    device_command_timeout: "60s"
  
  # 重试配置
  retry:
    max_attempts: 3
    backoff_delay: "1s"
    max_backoff_delay: "10s"

# 无线网络质量告警配置
radio_quality_alarm:
  # 是否启用告警功能
  enabled: true
  
  # 告警级别定义
  alarm_levels:
    level_1:
      name: "严重告警"
      description: "需要立即处理"
      icon: "🔴"
    level_2:
      name: "普通告警"
      description: "需要关注"
      icon: "🟡"
    level_3:
      name: "一般通知"
      description: "提示信息"
      icon: "🔵"
  
  # 告警规则配置
  rules:
    # RSRP规则
    rsrp_too_close:
      enabled: true
      parameter: "rsrp"
      condition: ">="
      threshold: -44
      alarm_reason: "Distance too close"
      alarm_level: 1
      description: "距离过近"
    
    rsrp_weak:
      enabled: true
      parameter: "rsrp"
      condition: "range"
      min_value: -103
      max_value: -85
      alarm_reason: "Signal relatively weak"
      alarm_level: 3
      description: "信号较弱"
    
    rsrp_very_weak:
      enabled: true
      parameter: "rsrp"
      condition: "range"
      min_value: -124
      max_value: -104
      alarm_reason: "Signal extremely weak"
      alarm_level: 2
      description: "信号极弱"
    
    # SNR规则
    snr_moderate:
      enabled: true
      parameter: "snr"
      condition: "range"
      min_value: 0
      max_value: 6
      alarm_reason: "Signal quality moderate"
      alarm_level: 3
      description: "信号质量一般"
    
    snr_very_poor:
      enabled: true
      parameter: "snr"
      condition: "<"
      threshold: 0
      alarm_reason: "Signal quality very poor"
      alarm_level: 2
      description: "信号质量很差"
    
    # 组合条件：环境干扰
    wireless_interference:
      enabled: true
      parameter: "combined_rsrp_snr"
      condition: "combined"
      rsrp_condition: ">"
      rsrp_threshold: -64
      snr_condition: "<"
      snr_threshold: 5
      alarm_reason: "Wireless environment interference"
      alarm_level: 1
      description: "无线环境干扰（信号强但质量差）"
  
  # 告警过滤配置
  filters:
    # 只处理主小区
    primary_cell_only: true  # cell_index = 0
    # 只处理通道1
    channel_1_only: true     # channel_index = 1
    # 是否需要设备在数据库中存在
    require_device_exists: false  # false表示即使设备不存在也创建告警
  
  # 告警推送配置
  push:
    # 避免重复推送
    no_duplicate: true       # 使用is_pushed标记
    # 推送后是否自动标记
    auto_mark_pushed: true
    # 推送失败重试次数
    max_retry: 3
  
  # 告警保留策略
  retention:
    # 已推送告警保留天数
    pushed_alarms_days: 7
    # 未推送告警保留天数
    unpushed_alarms_days: 30
    # 自动清理周期（小时）
    cleanup_interval_hours: 24