spring:
  application:
    name: vpd-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: vpd-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: ${BACKOFFICE_BIND_ADDRESS:0.0.0.0}
  port: ${BACKOFFICE_PORT:8080}
  forward-headers-strategy: ${BACKOFFICE_FORWARD_HEADERS_STRATEGY:none}
  servlet:
    session:
      cookie:
        secure: ${BACKOFFICE_SESSION_COOKIE_SECURE:false}
        http-only: true
        same-site: lax

backoffice:
  security:
    admin-user: ${BACKOFFICE_ADMIN_USER:admin}
    admin-password: ${BACKOFFICE_ADMIN_PASSWORD:admin}
    # A stable encoded value keeps signed remember-me cookies valid across restarts.
    admin-password-hash: ${BACKOFFICE_ADMIN_PASSWORD_HASH:}
    guest-enabled: ${BACKOFFICE_GUEST_ENABLED:false}
    guest-user: ${BACKOFFICE_GUEST_USER:guest}
    guest-password: ${BACKOFFICE_GUEST_PASSWORD:}
    guest-password-hash: ${BACKOFFICE_GUEST_PASSWORD_HASH:}
    require-https: ${BACKOFFICE_REQUIRE_HTTPS:false}
    remember-me-enabled: ${BACKOFFICE_REMEMBER_ME_ENABLED:false}
    remember-me-key: ${BACKOFFICE_REMEMBER_ME_KEY:}
    remember-me-days: ${BACKOFFICE_REMEMBER_ME_DAYS:14}
  token:
    max-days: ${BACKOFFICE_TOKEN_MAX_DAYS:365}
  ords:
    base-url: ${BACKOFFICE_ORDS_BASE_URL:https://g329127dfd380ad-kbaipoc.adb.ap-osaka-1.oraclecloudapps.com/ords}
    timeout: ${BACKOFFICE_ORDS_TIMEOUT_SECONDS:10}s
    agent-timeout: ${BACKOFFICE_ORDS_AGENT_TIMEOUT_SECONDS:180}s
    metadata-db:
      url: ${BACKOFFICE_ORDS_DB_URL:}
      username: ${BACKOFFICE_ORDS_DB_USERNAME:}
      password: ${BACKOFFICE_ORDS_DB_PASSWORD:}
  ai:
    enabled: ${BACKOFFICE_AI_ENABLED:false}
    provider: ${BACKOFFICE_AI_PROVIDER:openai}
    base-url: ${BACKOFFICE_AI_BASE_URL:${POC3_LLM_GPT55_OCI_ENDPOINT:}}
    model: ${BACKOFFICE_AI_MODEL:${POC3_LLM_GPT55_OCI_MODEL_ID:}}
    embedding-model: ${BACKOFFICE_AI_EMBEDDING_MODEL:}
    api-key: ${BACKOFFICE_AI_API_KEY:}
    timeout: ${BACKOFFICE_AI_TIMEOUT_SECONDS:30}s
    oci-config-file: ${BACKOFFICE_AI_OCI_CONFIG_FILE:${OCI_CONFIG_FILE:}}
    oci-profile: ${BACKOFFICE_AI_OCI_PROFILE:${OCI_PROFILE:DEFAULT}}
    oci-region: ${BACKOFFICE_AI_OCI_REGION:${POC3_LLM_GPT55_OCI_REGION:}}
    oci-compartment-id: ${BACKOFFICE_AI_OCI_COMPARTMENT_ID:${OCI_GENAI_COMPARTMENT_ID:}}
  select-ai:
    # Cloud AI profiles are schema-owned. This connection must use the profile owner's account,
    # not the control-plane account used by the backoffice.
    db-url: ${BACKOFFICE_SELECT_AI_DB_URL:}
    db-username: ${BACKOFFICE_SELECT_AI_DB_USERNAME:}
    db-password: ${BACKOFFICE_SELECT_AI_DB_PASSWORD:}
    profile: ${BACKOFFICE_SELECT_AI_PROFILE:}
    few-shot-enabled: ${BACKOFFICE_SELECT_AI_FEW_SHOT_ENABLED:true}
    few-shot-top-k: ${BACKOFFICE_SELECT_AI_FEW_SHOT_TOP_K:3}
  catalog:
    owner: ${BACKOFFICE_CATALOG_OWNER:}
    objects: ${BACKOFFICE_CATALOG_OBJECTS:}
  product:
    name: ${BACKOFFICE_PRODUCT_NAME:Data & AI Backoffice}
    title: ${BACKOFFICE_PRODUCT_TITLE:Data & AI Backoffice}
    data-label: ${BACKOFFICE_PRODUCT_DATA_LABEL:업무 데이터}
  mcp:
    tool-name: ${BACKOFFICE_MCP_TOOL_NAME:oracle.select_ai.data_text2sql}
    tool-label: ${BACKOFFICE_MCP_TOOL_LABEL:업무 데이터 Text2SQL}
    tool-description: ${BACKOFFICE_MCP_TOOL_DESCRIPTION:승인된 업무 데이터용 읽기 전용 SELECT/WITH SQL을 생성하고 검증 후 읽기 전용 트랜잭션에서 실행합니다. 생성 SQL과 최대 100건의 조회 결과를 함께 반환하며 DDL/DML/잠금/패키지 호출은 실행하지 않습니다.}
    prompt-description: ${BACKOFFICE_MCP_PROMPT_DESCRIPTION:업무 데이터에서 조회할 내용을 자연어로 입력합니다.}
    showprompt-tool-name: ${BACKOFFICE_MCP_SHOWPROMPT_TOOL_NAME:oracle.select_ai.data_showprompt}
    showprompt-tool-label: ${BACKOFFICE_MCP_SHOWPROMPT_TOOL_LABEL:업무 데이터 SHOWPROMPT}
    showprompt-tool-description: ${BACKOFFICE_MCP_SHOWPROMPT_TOOL_DESCRIPTION:Select AI가 SQL 생성에 사용한 prompt를 조회하는 읽기 전용 진단 도구입니다. 생성 SQL이나 데이터 조회 SQL은 실행하지 않습니다.}
    qa-vector-search-tool-name: ${BACKOFFICE_MCP_QA_VECTOR_SEARCH_TOOL_NAME:oracle.select_ai.qa_vector_search}
    qa-vector-search-tool-label: ${BACKOFFICE_MCP_QA_VECTOR_SEARCH_TOOL_LABEL:Select AI 예제 SQL 조회}
    qa-vector-search-tool-description: ${BACKOFFICE_MCP_QA_VECTOR_SEARCH_TOOL_DESCRIPTION:현재 질문에 사용할 유사 예제 SQL을 Select AI 실행 전에 조회합니다. 반환값은 few-shot 컨텍스트 검토용이며 SQL을 실행하지 않습니다.}
    qa-vector-store-tool-name: ${BACKOFFICE_MCP_QA_VECTOR_STORE_TOOL_NAME:oracle.select_ai.qa_vector_store}
    qa-vector-store-tool-label: ${BACKOFFICE_MCP_QA_VECTOR_STORE_TOOL_LABEL:Select AI 예제 SQL 저장}
    qa-vector-store-tool-description: ${BACKOFFICE_MCP_QA_VECTOR_STORE_TOOL_DESCRIPTION:검토된 Select AI 결과를 후속 Text2SQL 품질 향상용 예제 SQL로 저장합니다. 질문과 읽기 전용 답 SQL이 필요합니다.}
    few-shot-nl2sql-tool-name: ${BACKOFFICE_MCP_FEW_SHOT_NL2SQL_TOOL_NAME:oracle.select_ai.smilegate_fewshot_nl2sql}
    few-shot-nl2sql-tool-label: ${BACKOFFICE_MCP_FEW_SHOT_NL2SQL_TOOL_LABEL:Few-shot NL2SQL 실행}
    few-shot-nl2sql-tool-description: ${BACKOFFICE_MCP_FEW_SHOT_NL2SQL_TOOL_DESCRIPTION:벡터 Few-shot 예제를 찾아 prompt에 반영하고 SHOWSQL로 생성한 읽기 전용 SQL을 실행합니다. Few-shot 근거, 생성 SQL, 실행 결과를 함께 반환합니다.}
  masking:
    policies: ${BACKOFFICE_MASKING_POLICIES:}
  security-sql-scripts:
    scripts: ${BACKOFFICE_SECURITY_SQL_SCRIPTS:}
