# ==============================================================================
# 🚀 WA-AKG ENVIRONMENT CONFIGURATION TEMPLATE
# ==============================================================================
# Copy this file to .env before starting the application:
#   cp .env.example .env
#
# Variables are sorted by importance and dependency impact.
# ==============================================================================

# ==============================================
# 🎯 1. REQUIRED CORE SETTINGS
# ==============================================

# Server Listening Port (e.g. 3000, 3030). Ensure this port is free!
PORT="3000"

# Database Connection URL (Supports PostgreSQL or MySQL)
# Format: postgresql://user:password@host:port/database?schema=public
# Or: mysql://user:password@host:port/database
# Note: Ensure the protocol match your schema.prisma provider setting!
DATABASE_URL="mysql://root:@localhost:3306/wa_gateway_db"

# NextAuth Encryption Secret (Generate with: openssl rand -base64 32)
# Server will exit immediately if this is not configured in production!
AUTH_SECRET="x7Kp9mQ2vL8nR4tY6wZ1aB3cD5eF0gH2iJ4kL6mN8oP"

# Base URL where your application is hosted (e.g. http://localhost:3000 or https://your-domain.com)
BASE_URL="http://localhost:3000"

# Application Environment Mode (development | production | test)
NODE_ENV="development"

# Server Hostname binding
HOSTNAME="localhost"


# ==============================================
# 🔗 2. NEXTAUTH & PROXY INTEGRATION
# ==============================================

# URL for NextAuth redirects (Should match BASE_URL)
NEXTAUTH_URL="${BASE_URL}"

# Trust Proxy Headers (Set to "true" if deployed behind Nginx, Cloudflare, or reverse proxies)
AUTH_TRUST_HOST="true"

# Public facing Next.js URLs (Derived from BASE_URL)
NEXT_PUBLIC_APP_URL="${BASE_URL}"
NEXT_PUBLIC_API_URL="${BASE_URL}/api"


# ==============================================
# 🎨 3. BRANDING & GENERAL SETTINGS
# ==============================================

# Name of the application displayed in headers and sidebar
APP_NAME="WA-AKG"

# Custom Logo URL (leave empty to use default asset)
LOGO_URL=""

# Custom Favicon URL (leave empty to use default asset)
FAVICON_URL=""

# Chat list page size pagination limit (default: 50)
NEXT_PUBLIC_CHAT_PAGE_SIZE="50"

# Allow search engines to index public pages like docs/landing (true | false)
NEXT_PUBLIC_ALLOW_INDEXING="false"


# ==============================================
# 📚 4. SWAGGER API DOCUMENTATION (/docs)
# ==============================================

# Enable or disable the Swagger UI documentation route (true | false)
NEXT_PUBLIC_SWAGGER_ENABLED="true"

# Username for accessing Swagger UI basic auth credentials
NEXT_PUBLIC_SWAGGER_USERNAME="admin"

# Password for accessing Swagger UI basic auth credentials (change in production!)
NEXT_PUBLIC_SWAGGER_PASSWORD="admin123"


# ==============================================
# 🔌 5. WHATSAPP CORE (Baileys Engine)
# ==============================================

# Baileys Socket Logs Level (fatal | error | warn | info | debug | trace)
# Recommended: error for production, debug for development
BAILEYS_LOG_LEVEL="error"


# ==============================================
# 🔧 6. INTEGRATIONS & FEATURE FLAGS
# ==============================================

# Remove.bg API Key for automatic sticker background removal
# Register at https://www.remove.bg/api
REMOVE_BG_API_KEY=""

# Enable system notifications UI prompts (true | false)
ENABLE_NOTIFICATIONS="true"

# Periodically check for new WA-AKG releases (true | false)
ENABLE_AUTO_UPDATE_CHECK="true"

# Enable experimental gateway features (true | false)
ENABLE_EXPERIMENTAL_FEATURES="false"


# ==============================================
# 🛡️ 7. SECURITY & LIMITS
# ==============================================

# Session token expiration duration in hours
SESSION_TIMEOUT_HOURS="24"

# Maximum media file size allowed for uploads (in Megabytes)
MAX_UPLOAD_SIZE_MB="50"

# Enable API rate limiting protection (true | false)
ENABLE_RATE_LIMITING="true"

# Maximum requests per minute allowed per IP if rate limiting is enabled
RATE_LIMIT_PER_MINUTE="60"


# ==============================================
# 🌍 8. LOCALIZATION & STORAGE
# ==============================================

# Server default timezone for scheduled campaigns (e.g., Asia/Jakarta)
TZ="Asia/Jakarta"

# Default Locale for date/time formatting on the system (e.g., id-ID, en-US)
LOCALE="id-ID"

# Media files storage folder path (relative to the project root)
MEDIA_STORAGE_PATH="uploads"

# Google Analytics tracking ID (leave empty to disable)
NEXT_PUBLIC_GA_ID=""


# ==============================================
# 🐳 9. DOCKER COMPOSE CONFIGURATION
# ==============================================
# These variables are required ONLY when deploying via docker-compose.yml
MYSQL_ROOT_PASSWORD="change-this-in-production"
MYSQL_DATABASE="wa_akg"
ADMIN_EMAIL="admin@example.com"
ADMIN_PASSWORD="change-this-in-production"
