spring:
  datasource:
    # dev 使用可提交的开发测试库地址；密码仍通过环境变量注入。
    url: "jdbc:mysql://rm-7xv137v8f04vfk7a4ko.mysql.rds.aliyuncs.com:3306/th_hotel?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC"
    username: th_hotel_user
    password: 'CxrLg6b6kw2zJjmcjHUj'
    driver-class-name: com.mysql.cj.jdbc.Driver
  flyway:
    enabled: true
  servlet:
    multipart:
      # dev multipart 上限高于 Debug EML / 文件转换业务上限，超限文件由服务层返回受控 JSON 错误。
      max-file-size: ${DOCUMENT_CONVERSION_DEV_MULTIPART_MAX_FILE_BYTES:${DOCUMENT_CONVERSION_MULTIPART_MAX_FILE_BYTES:${DEBUG_EML_UPLOAD_DEV_MULTIPART_MAX_FILE_BYTES:${DEBUG_EML_UPLOAD_MULTIPART_MAX_FILE_BYTES:25165824}}}}
      max-request-size: ${DOCUMENT_CONVERSION_DEV_MULTIPART_MAX_REQUEST_BYTES:${DOCUMENT_CONVERSION_MULTIPART_MAX_REQUEST_BYTES:${DEBUG_EML_UPLOAD_DEV_MULTIPART_MAX_REQUEST_BYTES:${DEBUG_EML_UPLOAD_MULTIPART_MAX_REQUEST_BYTES:${DEBUG_EML_UPLOAD_DEV_MAX_REQUEST_BYTES:${DEBUG_EML_UPLOAD_MAX_REQUEST_BYTES:29360128}}}}}}

agentbus:
  probe:
    # dev 默认不主动连接 AgentBus，避免本地启动误消费消息。
    enabled: false
  ws:
    # AgentBus dev/test 真实测试地址可以提交；Token 仍走环境变量。
    url: wss://mesh.nianxx.cn/ws
    token: ${AGENTBUS_DEV_WS_TOKEN:}
    reconnect-delay: 5s
    connect-timeout: 15s
  capture:
    enabled: true
  superagent-dispatch:
    # dev 默认不自动调用 SuperAgent，需要联调时显式开启。
    enabled: ${AGENTBUS_DEV_SUPERAGENT_DISPATCH_ENABLED:${AGENTBUS_SUPERAGENT_DISPATCH_ENABLED:false}}
    worker-enabled: ${AGENTBUS_DEV_SUPERAGENT_DISPATCH_WORKER_ENABLED:${AGENTBUS_SUPERAGENT_DISPATCH_WORKER_ENABLED:false}}
    batch-size: ${AGENTBUS_DEV_SUPERAGENT_DISPATCH_BATCH_SIZE:${AGENTBUS_SUPERAGENT_DISPATCH_BATCH_SIZE:10}}
    max-attempts: ${AGENTBUS_DEV_SUPERAGENT_DISPATCH_MAX_ATTEMPTS:${AGENTBUS_SUPERAGENT_DISPATCH_MAX_ATTEMPTS:3}}
    lock-ttl: ${AGENTBUS_DEV_SUPERAGENT_DISPATCH_LOCK_TTL:${AGENTBUS_SUPERAGENT_DISPATCH_LOCK_TTL:5m}}
    initial-backoff: ${AGENTBUS_DEV_SUPERAGENT_DISPATCH_INITIAL_BACKOFF:${AGENTBUS_SUPERAGENT_DISPATCH_INITIAL_BACKOFF:30s}}
    max-backoff: ${AGENTBUS_DEV_SUPERAGENT_DISPATCH_MAX_BACKOFF:${AGENTBUS_SUPERAGENT_DISPATCH_MAX_BACKOFF:15m}}
    worker-fixed-delay-ms: ${AGENTBUS_DEV_SUPERAGENT_DISPATCH_WORKER_FIXED_DELAY_MS:${AGENTBUS_SUPERAGENT_DISPATCH_WORKER_FIXED_DELAY_MS:10000}}

superagent:
  task-result:
    # dev SuperAgent HMAC 密钥；优先使用 dev 专属变量，兼容旧通用变量。
    hmac-secret: ${SUPERAGENT_DEV_TASK_RESULT_HMAC_SECRET:${SUPERAGENT_TASK_RESULT_HMAC_SECRET:}}
  open-api:
    # dev Debug EML 调用 SuperAgent Open API；默认关闭，配置完整后再显式开启。
    enabled: ${SUPERAGENT_DEV_OPEN_API_ENABLED:${SUPERAGENT_OPEN_API_ENABLED:false}}
    base-url: ${DEERFLOW_DEV_BASE_URL:${DEERFLOW_BASE_URL:}}
    api-key: ${DEERFLOW_DEV_OPEN_API_KEY:${DEERFLOW_OPEN_API_KEY:}}
    external-subject-id: ${SUPERAGENT_DEV_DEBUG_EML_EXTERNAL_SUBJECT_ID:${SUPERAGENT_DEBUG_EML_EXTERNAL_SUBJECT_ID:th-hotel-debug-eml-upload}}
    agentbus-external-subject-id: ${SUPERAGENT_DEV_AGENTBUS_EXTERNAL_SUBJECT_ID:${SUPERAGENT_AGENTBUS_EXTERNAL_SUBJECT_ID:th-hotel-agentbus-source-message}}
    connect-timeout: ${SUPERAGENT_DEV_DEBUG_EML_CONNECT_TIMEOUT:${SUPERAGENT_DEBUG_EML_CONNECT_TIMEOUT:15s}}
    read-timeout: ${SUPERAGENT_DEV_DEBUG_EML_READ_TIMEOUT:${SUPERAGENT_DEBUG_EML_READ_TIMEOUT:180s}}
    sse-recovery-max-attempts: ${SUPERAGENT_DEV_OPEN_API_SSE_RECOVERY_MAX_ATTEMPTS:${SUPERAGENT_OPEN_API_SSE_RECOVERY_MAX_ATTEMPTS:5}}

aliyun:
  oss:
    endpoint: ${ALIYUN_OSS_DEV_ENDPOINT:${ALIYUN_OSS_ENDPOINT:}}
    bucket: ${ALIYUN_OSS_DEV_BUCKET:${ALIYUN_OSS_BUCKET:}}
    access-key-id: ${ALIYUN_OSS_DEV_ACCESS_KEY_ID:${ALIYUN_OSS_ACCESS_KEY_ID:}}
    access-key-secret: ${ALIYUN_OSS_DEV_ACCESS_KEY_SECRET:${ALIYUN_OSS_ACCESS_KEY_SECRET:}}
    public-base-url: ${ALIYUN_OSS_DEV_PUBLIC_BASE_URL:${ALIYUN_OSS_PUBLIC_BASE_URL:}}
    debug-eml-prefix: ${ALIYUN_OSS_DEV_DEBUG_EML_PREFIX:${ALIYUN_OSS_DEBUG_EML_PREFIX:debug/eml/}}

debug:
  eml-upload:
    # dev 默认关闭，需要本地或联调环境显式开启并配置访问口令。
    enabled: ${DEBUG_EML_UPLOAD_DEV_ENABLED:${DEBUG_EML_UPLOAD_ENABLED:false}}
    access-key: ${DEBUG_EML_UPLOAD_DEV_ACCESS_KEY:${DEBUG_EML_UPLOAD_ACCESS_KEY:}}
    max-file-bytes: ${DEBUG_EML_UPLOAD_DEV_MAX_FILE_BYTES:${DEBUG_EML_UPLOAD_MAX_FILE_BYTES:10485760}}
    sse-heartbeat-interval: ${DEBUG_EML_UPLOAD_DEV_SSE_HEARTBEAT_INTERVAL:${DEBUG_EML_UPLOAD_SSE_HEARTBEAT_INTERVAL:15s}}

document-conversion:
  # dev 默认关闭；本地安装 LibreOffice 和字体后再显式开启。
  enabled: ${DOCUMENT_CONVERSION_DEV_ENABLED:${DOCUMENT_CONVERSION_ENABLED:false}}
  access-key: ${DOCUMENT_CONVERSION_DEV_ACCESS_KEY:${DOCUMENT_CONVERSION_ACCESS_KEY:}}
  soffice-path: ${DOCUMENT_CONVERSION_DEV_SOFFICE_PATH:${DOCUMENT_CONVERSION_SOFFICE_PATH:soffice}}
  temp-dir: ${DOCUMENT_CONVERSION_DEV_TEMP_DIR:${DOCUMENT_CONVERSION_TEMP_DIR:${java.io.tmpdir}/th-hotel-document-conversion}}
  max-file-bytes: ${DOCUMENT_CONVERSION_DEV_MAX_FILE_BYTES:${DOCUMENT_CONVERSION_MAX_FILE_BYTES:20971520}}
  timeout-seconds: ${DOCUMENT_CONVERSION_DEV_TIMEOUT_SECONDS:${DOCUMENT_CONVERSION_TIMEOUT_SECONDS:60}}
  max-concurrent: ${DOCUMENT_CONVERSION_DEV_MAX_CONCURRENT:${DOCUMENT_CONVERSION_MAX_CONCURRENT:2}}
  output-oss-prefix: ${DOCUMENT_CONVERSION_DEV_OUTPUT_OSS_PREFIX:${DOCUMENT_CONVERSION_OUTPUT_OSS_PREFIX:document-conversions/excel-to-pdf/}}
  worker-enabled: ${DOCUMENT_CONVERSION_DEV_WORKER_ENABLED:${DOCUMENT_CONVERSION_WORKER_ENABLED:false}}

auth:
  bootstrap:
    admin:
      # dev 初始超级管理员只在系统没有超级管理员时创建；密码必须走环境变量。
      username: ${AUTH_DEV_BOOTSTRAP_ADMIN_USERNAME:${AUTH_BOOTSTRAP_ADMIN_USERNAME:}}
      password: ${AUTH_DEV_BOOTSTRAP_ADMIN_PASSWORD:${AUTH_BOOTSTRAP_ADMIN_PASSWORD:}}
      display-name: ${AUTH_DEV_BOOTSTRAP_ADMIN_DISPLAY_NAME:${AUTH_BOOTSTRAP_ADMIN_DISPLAY_NAME:系统管理员}}
    default-hotel-id: ${AUTH_DEV_BOOTSTRAP_DEFAULT_HOTEL_ID:${AUTH_BOOTSTRAP_DEFAULT_HOTEL_ID:HOTEL-DEV}}
    default-hotel-name: ${AUTH_DEV_BOOTSTRAP_DEFAULT_HOTEL_NAME:${AUTH_BOOTSTRAP_DEFAULT_HOTEL_NAME:开发酒店}}
    default-hotel-time-zone: ${AUTH_DEV_BOOTSTRAP_DEFAULT_HOTEL_TIME_ZONE:${AUTH_BOOTSTRAP_DEFAULT_HOTEL_TIME_ZONE:Asia/Bangkok}}
  session:
    ttl-minutes: ${AUTH_DEV_SESSION_TTL_MINUTES:${AUTH_SESSION_TTL_MINUTES:720}}

reservation:
  demo-data:
    # dev 本地联调默认开启演示数据造数接口；生产环境不得开启。
    enabled: true
    # 本地演示数据接口访问口令，需和 X-TH-Hotel-Demo-Data-Key 请求头一致。
    access-key: ${RESERVATION_DEV_DEMO_DATA_ACCESS_KEY:${RESERVATION_DEMO_DATA_ACCESS_KEY:}}

server:
  port: 8080
