spring:
  application:
    name: fitpub

  # Default to dev profile if not specified
  profiles:
    active: ${SPRING_PROFILES_ACTIVE:dev}

  # Datasource configuration is handled by Testcontainers in dev mode
  # For production, set these via environment variables:
  # - SPRING_DATASOURCE_URL
  # - SPRING_DATASOURCE_USERNAME
  # - SPRING_DATASOURCE_PASSWORD
  datasource:
    url: ${SPRING_DATASOURCE_URL:}
    username: ${SPRING_DATASOURCE_USERNAME:}
    password: ${SPRING_DATASOURCE_PASSWORD:}

  jpa:
    hibernate:
      ddl-auto: validate
    properties:
      hibernate:
        dialect: org.hibernate.dialect.PostgreSQLDialect
        format_sql: true
        use_sql_comments: true
    show-sql: false

  flyway:
    enabled: true
    baseline-on-migrate: true
    locations: classpath:db/migration
    schemas: public
    validate-on-migrate: true

  servlet:
    multipart:
      max-file-size: 50MB
      max-request-size: 50MB
      enabled: true

  jackson:
    serialization:
      write-dates-as-timestamps: false
    time-zone: UTC

# FitPub specific configuration
fitpub:
  # Domain and URL configuration
  domain: ${FITPUB_DOMAIN:localhost:8080}
  base-url: ${FITPUB_BASE_URL:http://localhost:8080}

  # ActivityPub federation settings
  activitypub:
    enabled: true
    max-federation-retries: 3
    request-timeout-seconds: 30

  # Security settings
  security:
    jwt:
      secret: ${JWT_SECRET:change-this-secret-key-in-production-must-be-at-least-32-characters-long}
      expiration: 86400000 # 24 hours in milliseconds

  # Registration settings
  registration:
    enabled: ${REGISTRATION_ENABLED:true}

  # Storage settings
  storage:
    fit-files:
      enabled: true
      retention-days: 365
    images:
      path: ${FITPUB_IMAGES_PATH:${java.io.tmpdir}/fitpub/images}
    tile-cache:
      path: ${FITPUB_TILE_CACHE_PATH:${java.io.tmpdir}/fitpub/tiles}

  # Image generation settings
  image:
    osm-tiles:
      enabled: ${OSM_TILES_ENABLED:true}

# Logging configuration
logging:
  level:
    root: INFO
    org.operaton.fitpub: DEBUG
    org.hibernate.SQL: DEBUG
    org.hibernate.type.descriptor.sql.BasicBinder: TRACE
    org.springframework.security: DEBUG

# Server configuration
server:
  port: ${PORT:8080}
  error:
    include-message: always
    include-binding-errors: always

# Actuator configuration
management:
  endpoints:
    web:
      exposure:
        include: health,info
      base-path: /actuator
  endpoint:
    health:
      show-details: when-authorized
      probes:
        enabled: true
  health:
    db:
      enabled: true
    diskspace:
      enabled: true
