# Document Intelligence Platform Configuration
# Author: Martin.Schweitzer@procon.co.at and claude.ai

server:
  port: 8889
  servlet:
    context-path: /api

spring:
  profiles:
    active: new

  application:
    name: document-intelligence-platform

  datasource:
    url: jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_NAME}
    username: ${DB_USERNAME}
    password: ${DB_PASSWORD}

    driver-class-name: org.postgresql.Driver
    hikari:
      maximum-pool-size: 5
      minimum-idle: 2
      connection-timeout: 30000
      idle-timeout: 300000
      max-lifetime: 900000
      leak-detection-threshold: 300000  # 5 minutes - increased to avoid false positives with batch processing

  jpa:
    hibernate:
      ddl-auto: validate
    show-sql: false
    open-in-view: false
    properties:
      hibernate:
        dialect: org.hibernate.dialect.PostgreSQLDialect
        format_sql: true
        default_schema: ted
        jdbc:
          batch_size: 25  # Match chunk size for optimal batch processing
        order_inserts: true
        order_updates: true

  flyway:
    enabled: false
    locations: classpath:db/migration
    baseline-on-migrate: true
    create-schemas: true
    schemas:
      - ted
      - doc
    default-schema: ted

# Apache Camel Configuration
camel:
  springboot:
    main-run-controller: true
  health:
    enabled: true
    # Weniger strenge Health-Checks für File-Consumer
    consumers-enabled: false

# Actuator endpoints
management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics,camel
  endpoint:
    health:
      show-details: when-authorized

# OpenAPI documentation
springdoc:
  api-docs:
    path: /v3/api-docs
  swagger-ui:
    path: /swagger-ui.html
    operations-sorter: method

# Logging configuration
logging:
  level:
    at.procon.ted: INFO
    at.procon.ted.camel.SolutionBriefRoute: INFO
    org.apache.camel: INFO
    org.hibernate.SQL: WARN
    org.hibernate.type.descriptor.sql: WARN
