# TankStopp Configuration File
# This file contains all configuration settings for the TankStopp application

# Server Configuration
server:
  host: "localhost"
  port: 8081
  read_timeout: 30s
  write_timeout: 30s
  idle_timeout: 120s
  shutdown_timeout: 10s

# Database Configuration
database:
  # Path to the SQLite database file
  path: "fuel_stops.db"

  # Connection Pool Settings
  connection_pool:
    max_idle_connections: 10
    max_open_connections: 100
    connection_max_lifetime: "1h"
    connection_max_idle_time: "30m"

  # Logging Settings
  logging:
    # Log levels: silent, error, warn, info
    level: "warn"
    # Log queries that take longer than this threshold
    slow_query_threshold: "200ms"
    # Enable debug mode for detailed logging
    debug: false

  # Migration Settings
  migration:
    # Automatically run migrations on startup
    auto_migrate: true
    # Drop tables before migration (USE WITH CAUTION)
    drop_tables_first: false
    # Batch size for bulk operations
    create_batch_size: 1000

  # Performance Settings
  performance:
    # Prepare statements for better performance
    prepare_statements: true
    # Disable foreign key checks during migrations
    disable_foreign_key_check: false
    # Ignore relationships when migrating
    ignore_relationships_when_migrating: false
    # Query all fields by default
    query_fields: true
    # Enable dry run mode for testing (no actual database changes)
    dry_run: false
    # Create records in batches
    create_in_batches: 100

# Application Settings
app:
  # Application name
  name: "TankStopp"
  # Application version
  version: "1.0.0"
  # Environment: development, production, test
  environment: "development"
  # Enable debug mode
  debug: true

# Security Settings
security:
  # Session configuration
  session:
    # Session timeout duration
    timeout: "24h"
    # Session cookie name
    cookie_name: "tankstopp_session"
    # Use secure cookies (requires HTTPS)
    secure_cookies: false
    # HTTP only cookies
    http_only: true

  # Password requirements
  password:
    min_length: 8
    require_uppercase: true
    require_lowercase: true
    require_numbers: true
    require_special_chars: false

# Logging Configuration
logging:
  # Log level: debug, info, warn, error
  level: "info"
  # Log format: json, text
  format: "text"
  # Log output: stdout, stderr, file
  output: "stdout"
  # Log file path (when output is file)
  file_path: "logs/tankstopp.log"
  # Enable log rotation
  rotation:
    enabled: false
    max_size: "100MB"
    max_age: "30d"
    max_backups: 5

# External Services
external_services:
  # OpenStreetMap Overpass API for fuel station search
  overpass_api:
    url: "https://overpass-api.de/api/interpreter"
    timeout: "30s"
    max_retries: 3
    search_radius: 5000  # meters

# Development Settings (only used in development environment)
development:
  # Enable hot reload
  hot_reload: true
  # Enable request logging
  request_logging: true
  # Enable profiling endpoints
  profiling: false
  # Static file serving
  static_files:
    directory: "./static"
    cache_duration: "1h"

# Production Settings (only used in production environment)
production:
  # Enable request logging
  request_logging: false
  # Enable profiling endpoints
  profiling: false
  # Static file serving
  static_files:
    directory: "./static"
    cache_duration: "24h"
  # Enable compression
  compression:
    enabled: true
    level: 6

# Feature Flags
features:
  # Enable fuel station search
  fuel_station_search: true
  # Enable vehicle management
  vehicle_management: true
  # Enable statistics dashboard
  statistics_dashboard: true
  # Enable data export
  data_export: true
  # Enable API endpoints
  api_endpoints: true

# Default User Settings
defaults:
  # Default currency for new users
  currency: "EUR"
  # Default fuel type for new vehicles
  fuel_type: "Super E5"
  # Default distance unit
  distance_unit: "km"
  # Default volume unit
  volume_unit: "liters"
