<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="transform.xslt"?>
<?app-config theme="dark" version="2.5"?>
<!-- 
  Sample XML File: Comments and Processing Instructions
  Provided by Sample-Files.com
  
  This file demonstrates XML comments and processing instructions (PIs)
  for testing how parsers handle, preserve, or strip these constructs.
-->
<configuration 
    xmlns="http://sample-files.com/samples/xml/config"
    created="2025-01-15"
    version="3.2.1">

  <!-- ============================================
       Section 1: Application Settings
       These settings control the core application behavior.
       ============================================ -->
  <application>
    <!-- The application name displayed in the title bar -->
    <name>SampleApp Pro</name>
    
    <!-- Debug mode: set to "true" only in development environments -->
    <debug>false</debug>
    
    <!-- 
      Log level options: TRACE, DEBUG, INFO, WARN, ERROR, FATAL
      Default: INFO
      Note: TRACE and DEBUG generate high volume output — 
      do not use in production without log rotation.
    -->
    <logLevel>INFO</logLevel>
    
    <!-- Maximum concurrent connections allowed -->
    <maxConnections>100</maxConnections>
    
    <!-- Timeout in milliseconds for API requests -->
    <requestTimeout>30000</requestTimeout>
  </application>

  <!-- ============================================
       Section 2: Database Configuration
       Supports PostgreSQL, MySQL, and SQLite.
       ============================================ -->
  <?db-migration lastRun="2025-01-10" status="complete"?>
  <database>
    <!-- Primary database connection -->
    <connection id="primary">
      <driver>postgresql</driver>
      <host>db.example.com</host>
      <port>5432</port>
      <name>sampleapp_production</name>
      <!-- 
        WARNING: In production, credentials should be loaded from 
        environment variables or a secrets manager, not from XML config.
        These values are placeholders for testing purposes only.
      -->
      <username>app_user</username>
      <password>placeholder_password</password>
      <pool>
        <minSize>5</minSize>
        <maxSize>20</maxSize>
        <!-- Idle timeout in seconds before connection is returned to pool -->
        <idleTimeout>300</idleTimeout>
      </pool>
    </connection>
    
    <!-- Read replica for reporting queries -->
    <connection id="replica">
      <driver>postgresql</driver>
      <host>db-replica.example.com</host>
      <port>5432</port>
      <name>sampleapp_production</name>
      <username>readonly_user</username>
      <password>placeholder_password</password>
      <!-- Replica uses a smaller pool since it handles fewer connections -->
      <pool>
        <minSize>2</minSize>
        <maxSize>10</maxSize>
        <idleTimeout>600</idleTimeout>
      </pool>
    </connection>
  </database>

  <!-- ============================================
       Section 3: Cache Configuration
       ============================================ -->
  <?cache-warmup enabled="true" interval="3600"?>
  <cache>
    <provider>redis</provider>
    <host>cache.example.com</host>
    <port>6379</port>
    <!-- TTL (time-to-live) values in seconds -->
    <defaultTTL>3600</defaultTTL>
    <!-- Prefix all cache keys to avoid collisions in shared Redis instances -->
    <keyPrefix>sampleapp:</keyPrefix>
  </cache>

  <!-- ============================================
       Section 4: Email / Notification Settings
       ============================================ -->
  <notifications>
    <email>
      <smtpHost>smtp.example.com</smtpHost>
      <smtpPort>587</smtpPort>
      <useTLS>true</useTLS>
      <!-- Sender address for system-generated emails -->
      <fromAddress>noreply@example.com</fromAddress>
      <fromName>SampleApp Notifications</fromName>
    </email>
    <!-- 
      Webhook URLs for external integrations.
      These are called on specific application events.
    -->
    <webhooks>
      <webhook event="user.signup" url="https://hooks.example.com/signup"/>
      <webhook event="order.complete" url="https://hooks.example.com/order"/>
      <webhook event="error.critical" url="https://hooks.example.com/alert"/>
    </webhooks>
  </notifications>

  <!-- ============================================
       Section 5: Feature Flags
       Toggle features without redeployment.
       ============================================ -->
  <?feature-sync lastSync="2025-01-15T08:30:00Z" source="remote"?>
  <featureFlags>
    <flag name="dark_mode" enabled="true" rollout="100"/>
    <flag name="new_checkout" enabled="true" rollout="50"/>
    <!-- Experimental: AI-powered search — currently in limited beta -->
    <flag name="ai_search" enabled="false" rollout="0"/>
    <flag name="two_factor_auth" enabled="true" rollout="100"/>
    <!-- Deprecated: will be removed in v4.0 -->
    <flag name="legacy_dashboard" enabled="true" rollout="100"/>
  </featureFlags>

  <!-- 
    End of configuration.
    For documentation, visit: https://docs.example.com/config
    For support, contact: support@example.com
  -->
</configuration>
