server:
  port: 8081

spring:
  application:
    name: beconnect-stock-service

  datasource:
    url: jdbc:mysql://${DB_HOST:mysql}:${DB_PORT:3306}/${DB_DATABASE:beconnect}?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
    username: ${DB_USERNAME:beconnect}
    password: ${DB_PASSWORD:beconnect_secret}
    driver-class-name: com.mysql.cj.jdbc.Driver
    hikari:
      maximum-pool-size: 20
      minimum-idle: 5
      connection-timeout: 10000
      idle-timeout: 300000

  jpa:
    hibernate:
      ddl-auto: none       # Migrações geridas pelo Laravel (Artisan migrate)
    show-sql: false
    open-in-view: false
    properties:
      hibernate:
        dialect: org.hibernate.dialect.MySQLDialect
        jdbc:
          batch_size: 50
        order_inserts: true
        order_updates: true

  data:
    redis:
      host: ${REDIS_HOST:redis}
      port: ${REDIS_PORT:6379}
      timeout: 3000ms
      lettuce:
        pool:
          max-active: 16
          max-idle: 8
          min-idle: 2

management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics
  endpoint:
    health:
      show-details: always

app:
  internal-api-key: ${INTERNAL_API_KEY:beconnect_internal}
  stock:
    reservation-ttl-minutes: 15    # Reservas expiram em 15 min se checkout não for completado
    low-stock-threshold: 5
