BROKER_ID=broker.ccp-it.dktk.dkfz.de
BROKER_URL=https://${BROKER_ID}
PROXY_ID=${SITE_ID}.${BROKER_ID}
FOCUS_BEAM_SECRET_SHORT="$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20)"
FOCUS_RETRY_COUNT=${FOCUS_RETRY_COUNT:-64}
SUPPORT_EMAIL=support-ccp@dkfz-heidelberg.de
PRIVATEKEYFILENAME=/etc/bridgehead/pki/${SITE_ID}.priv.pem

BROKER_URL_FOR_PREREQ=$BROKER_URL

OIDC_USER_GROUP="DKTK_CCP_$(capitalize_first_letter ${SITE_ID})"
OIDC_ADMIN_GROUP="DKTK_CCP_$(capitalize_first_letter ${SITE_ID})_Verwalter"
OIDC_PSP_GROUP="DKTK_CCP_$(capitalize_first_letter ${SITE_ID})_PSP"
OIDC_PRIVATE_CLIENT_ID=${SITE_ID}-private
OIDC_PUBLIC_CLIENT_ID=${SITE_ID}-public
OIDC_URL="https://sso.verbis.dkfz.de/application/o/${OIDC_PUBLIC_CLIENT_ID}/"
OIDC_PRIVATE_URL="https://sso.verbis.dkfz.de/application/o/${OIDC_PRIVATE_CLIENT_ID}/"
OIDC_GROUP_CLAIM="groups"

for module in $PROJECT/modules/*.sh
do
    log DEBUG "sourcing $module"
    source $module
done


# ========================================
# OVIS Bridgehead Module Configuration
# ========================================
# Copy this file to ccp/vars and customize for your site.
# This module supports CCP (FHIR-based) or DEMO (bundled data) import modes.
# ========================================

# Enable OVIS module
ENABLE_OVIS=

# ========================================
# IMPORT MODE
# ========================================
# Set to "ccp" for FHIR-based Clinical Cancer Profile import
# Set to "demo" for bundled demo data (no external dependencies)
OVIS_IMPORT_MODE=demo

# ========================================
# ROUTING / TRAEFIK
# ========================================
# Hostname for OVIS access
HOST=localhost

# Traefik middleware for authentication
OVIS_AUTH_MIDDLEWARE=traefik-forward-auth

# CORS origin for backend
OVIS_CORS_ORIGIN=*

# ========================================
# CORE RUNTIME
# ========================================
APOLLO_PORT=4001
CREDOS_PORT=4000
DB=onc_test
MONGO_VER=latest

# Frontend login toggle
PUBLIC_LOGIN_ENABLED=false

# ========================================
# CCP IMPORTER / FHIR SOURCE
# ========================================
# Only required when OVIS_IMPORT_MODE=ccp
# FHIR server URL (defaults to Bridgehead CCP Blaze)
FHIR_SERVER_URL=http://bridgehead-ccp-blaze:8080/fhir
FHIR_USERNAME=your-fhir-username
FHIR_PASSWORD=your-fhir-password

# Optional ICD10 filter for CCP import
ICD10_FILTER=

# ========================================
# PREPROCESSOR ENDPOINT
# ========================================
# URL for uploading omock.json to preprocessing service
# Uses Bridgehead service name (different from main compose default)
OVIS_PREPROCESSOR_URL=http://ovis-backend-data-preprocessing:9000/omock

# ========================================
# FRONTEND RUNTIME
# ========================================
# Catalogue upstream URL (uses Bridgehead service name)
OVIS_CATALOGUE_UPSTREAM_URL=http://ovis-backend-data-preprocessing:9000/catalogue

# Express auth configuration
EXPRESS_AUTH_URL=http://express-auth:5000
EXPRESS_AUTH_USERNAME=your-express-username
EXPRESS_AUTH_PASSWORD=your-express-password

# ========================================
# PROXY CONFIGURATION (Optional)
# ========================================
# Use these only if your server must access the internet through a corporate proxy.
# Leave all three empty when no proxy is required.
OVIS_HTTP_PROXY=
OVIS_HTTPS_PROXY=
OVIS_NO_PROXY=

# ========================================
# PREPROCESSOR OVERRIDES (Optional)
# ========================================
# These variables customize preprocessing behavior without code changes.
# See main compose.yaml for detailed documentation of each variable.

# Global / patient status
OVIS_PREPROC_DECEASED_KEYWORDS=["verstorben","dead","deceased","not alive","gestorben"]

# Rezidiv detection
OVIS_PREPROC_REZIDIV_PREFIXES=["Rezidiv"]
OVIS_PREPROC_REZIDIV_CANONICAL=Rezidiv
OVIS_PREPROC_REZIDIV_LYMPH_STATES=["Rezidiv","Neu"]

# Progress / DFS
OVIS_PREPROC_PROGRESS_LABELS=["Progression","Divergentes Geschehen","Rezidiv"]
OVIS_PREPROC_COMPLETE_REMISSION_LABELS=["Vollremission / Tumorfrei (complete remission)"]

# DFS start conditions
OVIS_PREPROC_RCLASS_SUCCESS=["R0"]
OVIS_PREPROC_LOCAL_RSTATE_SUCCESS=["R0"]

# Metastasis detection
OVIS_PREPROC_METASTASIS_PREFIXES=["Rezidiv","Neu"]
OVIS_PREPROC_METASTASIS_SPREAD_VALUES=["Neu","Rezidiv","Tumornachweis"]
OVIS_PREPROC_METASTASIS_STRAT_SYNCHRON=Synchrone Metastasierung
OVIS_PREPROC_METASTASIS_STRAT_NONE=keine synchrone Metastasierung

# Study phases to treat as null
OVIS_PREPROC_NULL_STUDY_PHASES=["NOPH","KA"]

# Therapy mappings
OVIS_PREPROC_PREV_THERAPY_SURGERY=["operation"]
OVIS_PREPROC_PREV_THERAPY_SYSTEMIC=["systemic"]
OVIS_PREPROC_PREV_THERAPY_RADIATION=["radiation"]

# Consultation mappings
OVIS_PREPROC_PREV_CONSULTATION_NUTRITION=["nutrition"]
OVIS_PREPROC_PREV_CONSULTATION_SOCIAL=["social"]
OVIS_PREPROC_PREV_CONSULTATION_PSYCHO=["psycho"]
OVIS_PREPROC_PREV_CONSULTATION_GENETIC=["genetic"]

# Tumorboard patterns (regex)
OVIS_PREPROC_TUMORBOARD_PATTERN_PRAE=prae|prä|pre
OVIS_PREPROC_TUMORBOARD_PATTERN_POST=post
OVIS_PREPROC_TUMORBOARD_PATTERN_MTB=mtb

# ECOG and distress
OVIS_PREPROC_ECOG_PREFIX=ECOG
OVIS_PREPROC_DISTRESS_TYPE=distress
OVIS_PREPROC_DISTRESS_POSITIVE_VALUES=["Positiv"]


idManagementSetup
mtbaSetup
obds2fhirRestSetup
blazeSecondarySetup

for module in modules/*.sh
do
    log DEBUG "sourcing $module"
    source $module
done

transfairSetup
