spring:
  application:
    name: user
  profiles:
    active: ${SPRING_PROFILES_ACTIVE:dev}

  # Database Configuration
  datasource:
    url: jdbc:${DB_KIND:postgresql}://${DB_HOST:localhost}:${DB_PORT:5432}/${DB_NAME:userdb}
    username: ${DB_USERNAME:hgzerouser}
    password: ${DB_PASSWORD:}
    driver-class-name: org.postgresql.Driver
    hikari:
      maximum-pool-size: 20
      minimum-idle: 5
      connection-timeout: 30000
      idle-timeout: 600000
      max-lifetime: 1800000
      leak-detection-threshold: 60000

  # JPA Configuration
  jpa:
    show-sql: ${SHOW_SQL:true}
    properties:
      hibernate:
        format_sql: true
        use_sql_comments: true
        dialect: org.hibernate.dialect.PostgreSQLDialect
        jdbc:
          time_zone: Asia/Seoul
    hibernate:
      ddl-auto: ${JPA_DDL_AUTO:update}
    database: postgresql
    database-platform: org.hibernate.dialect.PostgreSQLDialect

  # Flyway Configuration
  flyway:
    enabled: false

  # Redis Configuration
  data:
    redis:
      host: ${REDIS_HOST:localhost}
      port: ${REDIS_PORT:6379}
      password: ${REDIS_PASSWORD:}
      timeout: 2000ms
      lettuce:
        pool:
          max-active: 8
          max-idle: 8
          min-idle: 0
          max-wait: -1ms
      database: ${REDIS_DATABASE:0}

  # LDAP Configuration (비활성화 for development)
  # ldap:
  #   urls: ${LDAP_URLS:ldaps://ldap.example.com:636}
  #   base: ${LDAP_BASE:dc=example,dc=com}
  #   username: ${LDAP_USERNAME:}
  #   password: ${LDAP_PASSWORD:}
  #   user-dn-pattern: ${LDAP_USER_DN_PATTERN:uid={0},ou=people}

  # Event Configuration (Azure EventHub)
  cloud:
    azure:
      eventhub:
        connection-string: ${EVENTHUB_CONNECTION_STRING:}
        name: ${EVENTHUB_NAME:hgzero-eventhub-name}

# Server Configuration
server:
  port: ${SERVER_PORT:8081}

# JWT Configuration
jwt:
  secret: ${JWT_SECRET:dev-jwt-secret-key-for-development-only}
  access-token-validity: ${JWT_ACCESS_TOKEN_VALIDITY:3600}
  refresh-token-validity: ${JWT_REFRESH_TOKEN_VALIDITY:604800}

# API Keys Configuration
api:
  keys:
    claude: ${CLAUDE_API_KEY:}
    openai: ${OPENAI_API_KEY:}
    openweather: ${OPENWEATHER_API_KEY:}
    kakao: ${KAKAO_API_KEY:}

# CORS Configuration
cors:
  allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:*}

# Actuator Configuration
management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics,prometheus
      base-path: /actuator
  endpoint:
    health:
      show-details: always
      show-components: always
  health:
    livenessState:
      enabled: true
    readinessState:
      enabled: true
    ldap:
      enabled: false

# OpenAPI Documentation
springdoc:
  api-docs:
    path: /v3/api-docs
  swagger-ui:
    path: /swagger-ui.html
    tags-sorter: alpha
    operations-sorter: alpha
  show-actuator: false

# Logging Configuration
logging:
  level:
    root: ${LOG_LEVEL_ROOT:INFO}
    com.unicorn.hgzero.user: ${LOG_LEVEL_APP:DEBUG}
    org.springframework.web: ${LOG_LEVEL_WEB:INFO}
    org.springframework.security: ${LOG_LEVEL_SECURITY:DEBUG}
    org.hibernate.SQL: ${LOG_LEVEL_SQL:DEBUG}
    org.hibernate.type: ${LOG_LEVEL_SQL_TYPE:TRACE}
  pattern:
    console: "%d{yyyy-MM-dd HH:mm:ss} - %msg%n"
    file: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
  file:
    name: ${LOG_FILE:logs/user-service.log}
  logback:
    rollingpolicy:
      max-file-size: 10MB
      max-history: 7
      total-size-cap: 100MB
