apiVersion: v1
kind: ConfigMap
metadata:
  name: stonks-config
  namespace: stonks-oracle
  labels:
    app.kubernetes.io/part-of: stonks-oracle
data:
  # PostgreSQL — existing cluster service
  POSTGRES_HOST: "postgresql-rw.postgresql-service.svc.cluster.local"
  POSTGRES_PORT: "5432"
  POSTGRES_DB: "stonks"
  POSTGRES_USER: "stonks"

  # Redis — existing cluster service
  REDIS_HOST: "redis-master.redis-service.svc.cluster.local"
  REDIS_PORT: "6379"
  REDIS_DB: "0"

  # MinIO — existing cluster service
  MINIO_ENDPOINT: "minio.minio-service.svc.cluster.local:80"
  MINIO_SECURE: "false"

  # Ollama — existing cluster service
  OLLAMA_BASE_URL: "http://ollama.ollama-service.svc.cluster.local:11434"
  OLLAMA_MODEL: "llama3.1:8b"
  OLLAMA_TIMEOUT: "120"
  OLLAMA_MAX_RETRIES: "2"
  OLLAMA_RETRY_BASE_DELAY: "1.0"
  OLLAMA_RETRY_MAX_DELAY: "10.0"
  OLLAMA_RETRY_BACKOFF_MULTIPLIER: "2.0"

  # Trino — deployed in stonks-oracle namespace
  TRINO_HOST: "trino.stonks-oracle.svc.cluster.local"
  TRINO_PORT: "8080"
  TRINO_CATALOG: "lakehouse"
  TRINO_SCHEMA: "stonks"
  TRINO_ICEBERG_CATALOG: "iceberg"

  # Broker
  BROKER_MODE: "paper"
  BROKER_PROVIDER: "alpaca"

  # Market Data
  MARKET_DATA_BASE_URL: "https://api.polygon.io"
  MARKET_DATA_PROVIDER: "polygon"

  # Retention (days per bucket class)
  RETENTION_RAW_MARKET_DAYS: "90"
  RETENTION_RAW_NEWS_DAYS: "180"
  RETENTION_RAW_FILINGS_DAYS: "365"
  RETENTION_NORMALIZED_DAYS: "180"
  RETENTION_LLM_PROMPTS_DAYS: "365"
  RETENTION_LLM_RESULTS_DAYS: "365"
  RETENTION_LAKEHOUSE_DAYS: "730"
  RETENTION_AUDIT_DAYS: "730"
  RETENTION_CLEANUP_INTERVAL_HOURS: "24"
  RETENTION_BATCH_SIZE: "1000"

  # General
  LOG_LEVEL: "INFO"
  JSON_LOGS: "true"

  # Alerting thresholds
  ALERT_SOURCE_FAILURE_THRESHOLD: "3"
  ALERT_SOURCE_FAILURE_WINDOW_HOURS: "6"
  ALERT_SCHEMA_FAILURE_RATE_THRESHOLD: "0.3"
  ALERT_SCHEMA_FAILURE_WINDOW_HOURS: "1"
  ALERT_LAKE_LAG_THRESHOLD_MINUTES: "60"
  ALERT_BROKER_ERROR_THRESHOLD: "3"
  ALERT_BROKER_ERROR_WINDOW_HOURS: "1"
  ALERT_CHECK_INTERVAL_SECONDS: "120"
