# =====================================================
# POSTGRESQL DATABASE - Local Development
# =====================================================
DATABASE_URL=postgresql://bmc_hub:bmc_hub@postgres:5432/bmc_hub

# Database credentials (bruges af docker-compose)
POSTGRES_USER=bmc_hub
POSTGRES_PASSWORD=bmc_hub
POSTGRES_DB=bmc_hub
POSTGRES_PORT=5433  # Changed from 5432 to avoid conflicts with other services

# =====================================================
# API CONFIGURATION
# =====================================================
API_HOST=0.0.0.0
API_PORT=8001  # Changed from 8000 to avoid conflicts with other services
ENABLE_RELOAD=false  # Set to true for live code reload (causes log spam in Docker)

# =====================================================
# SECURITY
# =====================================================
SECRET_KEY=change-this-in-production-use-random-string
CORS_ORIGINS=http://localhost:8000,http://localhost:3000

# Telefoni (Yealink) callbacks security (MUST set at least one)
# Option A: Shared secret token (recommended)
TELEFONI_SHARED_SECRET=
# Option B: IP whitelist (LAN only) - supports IPs and CIDRs
TELEFONI_IP_WHITELIST=127.0.0.1

# Shadow Admin (Emergency Access)
SHADOW_ADMIN_ENABLED=false
SHADOW_ADMIN_USERNAME=shadowadmin
SHADOW_ADMIN_PASSWORD=
SHADOW_ADMIN_TOTP_SECRET=
SHADOW_ADMIN_EMAIL=shadowadmin@bmcnetworks.dk
SHADOW_ADMIN_FULL_NAME=Shadow Administrator

# =====================================================
# LOGGING
# =====================================================
LOG_LEVEL=INFO
LOG_FILE=logs/app.log

# =====================================================
# GITHUB/GITEA REPOSITORY (Optional - for reference)
# =====================================================
# Repository: https://g.bmcnetworks.dk/ct/bmc_hub
GITHUB_REPO=ct/bmc_hub

# =====================================================
# e-conomic Integration (Optional)
# =====================================================
# Get credentials from e-conomic Settings -> Integrations -> API
ECONOMIC_API_URL=https://restapi.e-conomic.com
ECONOMIC_APP_SECRET_TOKEN=your_app_secret_token_here
ECONOMIC_AGREEMENT_GRANT_TOKEN=your_agreement_grant_token_here

# 🚨 SAFETY SWITCHES - Beskytter mod utilsigtede ændringer
ECONOMIC_READ_ONLY=true   # Set to false ONLY after testing
ECONOMIC_DRY_RUN=true     # Set to false ONLY when ready for production writes
# =====================================================
# Nextcloud Integration (Optional)
# =====================================================
NEXTCLOUD_READ_ONLY=true
NEXTCLOUD_DRY_RUN=true
NEXTCLOUD_TIMEOUT_SECONDS=15
NEXTCLOUD_CACHE_TTL_SECONDS=300
# Generate a Fernet key: python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
NEXTCLOUD_ENCRYPTION_KEY=

# =====================================================
# vTiger Cloud Integration (Required for Subscriptions)
# =====================================================
# Get credentials from vTiger Cloud -> Settings -> Integration -> Webservices
VTIGER_URL=https://your-instance.od2.vtiger.com
VTIGER_USERNAME=your_vtiger_username
VTIGER_API_KEY=your_vtiger_api_key

# =====================================================
# Simply-CRM / Old vTiger On-Premise (Legacy)
# =====================================================
# Old vTiger installation (if different from cloud)
OLD_VTIGER_URL=http://your-old-vtiger-server.com
OLD_VTIGER_USERNAME=your_old_username
OLD_VTIGER_API_KEY=your_old_api_key

# =====================================================
# EMAIL SYSTEM CONFIGURATION
# =====================================================
# IMAP Settings (Standard email)
IMAP_SERVER=imap.gmail.com
IMAP_PORT=993
IMAP_USERNAME=your_email@gmail.com
IMAP_PASSWORD=your_app_password
IMAP_USE_SSL=true
IMAP_FOLDER=INBOX
IMAP_READ_ONLY=true  # Safety: READ-ONLY mode

# Microsoft Graph API (Alternative to IMAP - for Office365/Outlook)
USE_GRAPH_API=false
GRAPH_TENANT_ID=your_tenant_id
GRAPH_CLIENT_ID=your_client_id
GRAPH_CLIENT_SECRET=your_client_secret
GRAPH_USER_EMAIL=your_email@domain.com

# Email Processing Settings
EMAIL_TO_TICKET_ENABLED=false
EMAIL_RULES_ENABLED=true
EMAIL_RULES_AUTO_PROCESS=false
EMAIL_AI_ENABLED=false
EMAIL_AUTO_CLASSIFY=false
EMAIL_AI_CONFIDENCE_THRESHOLD=0.7
EMAIL_MAX_FETCH_PER_RUN=50
EMAIL_PROCESS_INTERVAL_MINUTES=5
EMAIL_WORKFLOWS_ENABLED=true
EMAIL_MAX_UPLOAD_SIZE_MB=50
ALLOWED_EXTENSIONS=.pdf,.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.zip