spring:
  application:
    name: dds-permission-backoffice
  datasource:
    url: ${BACKOFFICE_DB_URL:jdbc:oracle:thin:@localhost:1521/FREEPDB1}
    username: ${BACKOFFICE_DB_USERNAME:backoffice}
    password: ${BACKOFFICE_DB_PASSWORD:backoffice}
    driver-class-name: oracle.jdbc.OracleDriver
    hikari:
      pool-name: dds-backoffice-pool
      maximum-pool-size: ${BACKOFFICE_DB_POOL_MAX:10}
      minimum-idle: ${BACKOFFICE_DB_POOL_MIN:2}
      connection-timeout: 10000
      idle-timeout: ${BACKOFFICE_DB_POOL_IDLE_TIMEOUT_MS:300000}
      keepalive-time: ${BACKOFFICE_DB_POOL_KEEPALIVE_MS:120000}
  thymeleaf:
    cache: false

mybatis:
  mapper-locations: classpath:/mapper/*.xml
  configuration:
    map-underscore-to-camel-case: true

server:
  address: ${DDS_BACKOFFICE_BIND_ADDRESS:0.0.0.0}
  port: ${DDS_BACKOFFICE_PORT:8083}
  forward-headers-strategy: ${DDS_BACKOFFICE_FORWARD_HEADERS_STRATEGY:none}
  servlet:
    session:
      cookie:
        name: DDS_BACKOFFICE_SESSION
        secure: ${DDS_BACKOFFICE_SESSION_COOKIE_SECURE:false}
        http-only: true
        same-site: lax

backoffice:
  security:
    admin-user: ${DDS_BACKOFFICE_ADMIN_USER:${BACKOFFICE_ADMIN_USER:admin}}
    admin-password: ${DDS_BACKOFFICE_ADMIN_PASSWORD:${BACKOFFICE_ADMIN_PASSWORD:admin}}
    require-https: ${DDS_BACKOFFICE_REQUIRE_HTTPS:false}
  token:
    max-days: ${BACKOFFICE_TOKEN_MAX_DAYS:365}
  ords:
    base-url: ${BACKOFFICE_ORDS_BASE_URL:}
    timeout: ${BACKOFFICE_ORDS_TIMEOUT_SECONDS:10}s
    metadata-db:
      url: ${BACKOFFICE_ORDS_DB_URL:}
      username: ${BACKOFFICE_ORDS_DB_USERNAME:}
      password: ${BACKOFFICE_ORDS_DB_PASSWORD:}
  ai:
    enabled: ${BACKOFFICE_AI_ENABLED:false}
    base-url: ${BACKOFFICE_AI_BASE_URL:}
    model: ${BACKOFFICE_AI_MODEL:}
    embedding-model: ${BACKOFFICE_AI_EMBEDDING_MODEL:}
    api-key: ${BACKOFFICE_AI_API_KEY:}
    timeout: ${BACKOFFICE_AI_TIMEOUT_SECONDS:30}s

dds:
  mcp:
    permission-sync-enabled: true
    iam:
      domain-url: ${DDS_OCI_IAM_DOMAIN_URL:}
      token-uri: ${DDS_OCI_IAM_TOKEN_URI:}
      client-id: ${DDS_OCI_IAM_CLIENT_ID:}
      client-secret: ${DDS_OCI_IAM_CLIENT_SECRET:}
      database-scope: ${DDS_OCI_IAM_DATABASE_SCOPE:}
      timeout: ${DDS_OCI_IAM_TIMEOUT_SECONDS:10s}
      refresh-skew: ${DDS_OCI_IAM_REFRESH_SKEW_SECONDS:60s}
  db-url: ${DDS_BACKOFFICE_DB_URL:${BACKOFFICE_DB_URL:jdbc:oracle:thin:@localhost:1521/FREEPDB1}}
  query-timeout: ${DDS_BACKOFFICE_QUERY_TIMEOUT:10s}
  pg-object: ${DDS_BACKOFFICE_PG_OBJECT:ADMIN.V_DDS_CUSTOMERS_PG}
  my-object: ${DDS_BACKOFFICE_MY_OBJECT:ADMIN.V_DDS_CUSTOMERS_MY}
  vector-object: ${DDS_BACKOFFICE_VECTOR_OBJECT:ADMIN.CB_DDS_VECTOR_SEARCH_DOCUMENTS}
  object-mappings:
    CB_VECTOR_SEARCH_DOCUMENTS: ${DDS_BACKOFFICE_VECTOR_OBJECT:ADMIN.CB_DDS_VECTOR_SEARCH_DOCUMENTS}
    CB_V_SEARCH_DOCUMENTS: ${DDS_BACKOFFICE_DOCUMENT_OBJECT:ADMIN.CB_DDS_V_SEARCH_DOCUMENTS}
  token:
    username: ${DDS_BACKOFFICE_TOKEN_USERNAME:dds_demo_token}
    password: ${DDS_BACKOFFICE_TOKEN_PASSWORD:${DDSUSER_TOKEN_PASSWORD:}}
    data-role: ${DDS_BACKOFFICE_TOKEN_DATA_ROLE:cb_dds_token_role}
  users:
    my:
      label: MY 전용 사용자
      description: MySQL 원본만 허용하는 DATA ROLE
      username: ${DDS_BACKOFFICE_MY_USERNAME:dds_demo_my}
      password: ${DDS_BACKOFFICE_MY_PASSWORD:${DDSUSER_MY_PASSWORD:}}
      application-user-id: ${DDS_BACKOFFICE_MY_APPLICATION_USER_ID:101}
      data-role: ${DDS_BACKOFFICE_MY_DATA_ROLE:dds_demo_my_role}
    pg:
      label: PG 전용 사용자
      description: PostgreSQL 원본만 허용하는 DATA ROLE
      username: ${DDS_BACKOFFICE_PG_USERNAME:dds_demo_pg}
      password: ${DDS_BACKOFFICE_PG_PASSWORD:${DDSUSER_PG_PASSWORD:}}
      application-user-id: ${DDS_BACKOFFICE_PG_APPLICATION_USER_ID:102}
      data-role: ${DDS_BACKOFFICE_PG_DATA_ROLE:dds_demo_pg_role}
    both:
      label: 통합 사용자
      description: 두 원본을 모두 허용하는 DATA ROLE
      username: ${DDS_BACKOFFICE_BOTH_USERNAME:dds_demo_both}
      password: ${DDS_BACKOFFICE_BOTH_PASSWORD:${DDSUSER_BOTH_PASSWORD:}}
      application-user-id: ${DDS_BACKOFFICE_BOTH_APPLICATION_USER_ID:103}
      data-role: ${DDS_BACKOFFICE_BOTH_DATA_ROLE:dds_demo_both_role}
    none:
      label: 차단 사용자
      description: 접속만 가능하고 DATA GRANT가 없는 사용자
      username: ${DDS_BACKOFFICE_NONE_USERNAME:dds_demo_none}
      password: ${DDS_BACKOFFICE_NONE_PASSWORD:${DDSUSER_NONE_PASSWORD:}}
      application-user-id: ${DDS_BACKOFFICE_NONE_APPLICATION_USER_ID:0}
      data-role: ${DDS_BACKOFFICE_NONE_DATA_ROLE:dds_demo_none_role}
