server:
  port: 8080
  forward-headers-strategy: framework

spring:
  datasource:
    # 기본값은 로컬(Compose) MySQL. .env로 덮어쓸 수 있음.
    url: jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3307}/${DB_NAME:soso}?serverTimezone=Asia/Seoul&characterEncoding=UTF-8
    username: ${DB_USER:soso_user}
    password: ${DB_PASS:12341234}
    driver-class-name: com.mysql.cj.jdbc.Driver

  jpa:
    hibernate:
      ddl-auto: ${JPA_DDL:update} # 운영은 validate/none 권장
    properties:
      hibernate:
        format_sql: true
        use_sql_comments: true
        dialect: org.hibernate.dialect.MySQL8Dialect
    open-in-view: false

  sql:
    init:
      encoding: UTF-8

  jackson:
    default-property-inclusion: always

  servlet:
    multipart:
      enabled: true
      max-file-size: 5MB
      max-request-size: 25MB  # 이미지 4개 + 메타데이터

  session:
    store-type: redis
    redis:
      namespace: shboard:session

  data:
    redis:
      host: ${REDIS_HOST:localhost}
      port: ${REDIS_PORT:6379}

  # Kafka 미사용시 KAFKA_BOOTSTRAP 비워둬도 됨
  kafka:
    bootstrap-servers: ${KAFKA_BOOTSTRAP:}
    consumer:
      group-id: soso-group
      auto-offset-reset: earliest
      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
      value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
      properties:
        spring.json.trusted.packages: "com.example.soso.vote.dto"
    producer:
      key-serializer: org.apache.kafka.common.serialization.StringSerializer
      value-serializer: org.springframework.kafka.support.serializer.JsonSerializer

  cloud:
    aws:
      region: ${AWS_REGION:ap-northeast-2}
      credentials:
        access-key: ${AWS_ACCESS_KEY_ID:}
        secret-key: ${AWS_SECRET_ACCESS_KEY:}
      s3:
        bucket: ${AWS_S3_BUCKET:dreampaste-soso-image-storage}
        base-url: ${S3_BASE_URL:https://dreampaste-soso-image-storage.s3.ap-northeast-2.amazonaws.com}
        endpoint: ${AWS_S3_ENDPOINT:}
        path-style-access: ${AWS_S3_PATH_STYLE_ACCESS:false}
    gcp:
      storage:
        bucket: ${GCP_STORAGE_BUCKET:unused}
        base-url: ${GCP_STORAGE_BASE_URL:unused}
kafka:
  topics:
    vote-events: vote-events
    vote-counts: vote-counts
    popular-votes: popular-votes
    trending-votes: trending-votes
    vote-summary: vote-summary

oauth:
  kakao:
    client-id: ${KAKAO_CLIENT_ID:}
    # 콤마로 여러 개(로컬 & Vercel). 백엔드에서 선택/검증해서 사용.
    redirect-uris: ${KAKAO_REDIRECT_URIS:http://localhost:3000/auth,https://soso-front-end-web.vercel.app/auth}
    redirect-uri: ${KAKAO_REDIRECT_URI:http://localhost:3000/auth}

jwt:
  secret-key: ${JWT_SECRET:}
  access-token-validity-in-ms: ${JWT_AT_VALIDITY:1800000}
  refresh-token-validity-in-ms: ${JWT_RT_VALIDITY:1209600000}

# CORS 허용 원점(쉼표 분리)
frontend:
  origin: ${FRONTEND_ORIGIN:http://localhost:3000,https://soso-front-end-web.vercel.app}
