async function startScanning() {
  try {
    const isConfigured = await setupService.isConfigured();
    if (!isConfigured) {
      console.log(`Setup not completed. Visit http://your-machine-ip:${process.env.PAPERLESS_AI_PORT || 3000}/setup to complete setup.`);
    }

    const userId = await paperlessService.getOwnUserID();
    if (!userId) {
      console.error('Failed to get own user ID. Abort scanning.');
      return;
    }

    console.log('Configured scan interval:', config.scanInterval);
    console.log(`Starting initial scan at ${new Date().toISOString()}`);
    if(config.disableAutomaticProcessing != 'yes') {
      await scanInitial();
  
      cron.schedule(config.scanInterval, async () => {
        console.log(`Starting scheduled scan at ${new Date().toISOString()}`);
        await scanDocuments();
      });
    }
  } catch (error) {
    console.error('[ERROR] in startScanning:', error);
  }
}
@swagger
/health:
  get:
    summary: System health check endpoint
    description: |
      Checks if the application is properly configured and the database is reachable.
      This endpoint can be used by monitoring systems to verify service health.
      
      The endpoint returns a 200 status code with a "healthy" status if everything is 
      working correctly, or a 503 status code with error details if there are issues.
    tags: [System]
    responses:
      200:
        description: System is healthy and operational
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  type: string
                  example: "healthy"
                  description: Health status indication
      503:
        description: System is not fully configured or database is unreachable
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  type: string
                  enum: [not_configured, error]
                  example: "not_configured"
                  description: Error status type
                message:
                  type: string
                  example: "Application setup not completed"
                  description: Detailed error message