import { env } from '$env/dynamic/private';

/**
 * Server-side configuration for the async queue system
 * Uses SvelteKit's $env/dynamic/private for runtime environment access
 *
 * Environment Variables:
 * - QUEUE_CONCURRENCY: Number of items to process concurrently (default: 2)
 * - QUEUE_MAX_RETRIES: Maximum retry attempts for failed items (default: 3)
 * - TANDOOR_TOKEN: Token for Tandoor API authentication
 * - TANDOOR_SERVER_URL: Base URL for Tandoor server
 * - VAPID_PUBLIC_KEY: Public VAPID key for web push notifications
 * - VAPID_PRIVATE_KEY: Private VAPID key for web push notifications
 * - VAPID_EMAIL: Contact email for web push notifications (mailto: URI scheme)
 */
export const queueConfig = {
	/** Number of items to process concurrently (default: 2) */
	concurrency: parseInt(env.QUEUE_CONCURRENCY || '2', 10),

	/** Maximum retry attempts for failed items (default: 3) */
	maxRetries: parseInt(env.QUEUE_MAX_RETRIES || '3', 10),

	/** Tandoor integration settings */
	tandoor: {
		enabled: !!env.TANDOOR_TOKEN,
		token: env.TANDOOR_TOKEN || null,
		serverUrl: env.TANDOOR_SERVER_URL || null
	},

	/** Web Push notification settings */
	push: {
		vapidPublicKey:
			env.VAPID_PUBLIC_KEY ||
			'BNextdcB_fQ0BVvyGioM5L8Tf9vKQjs-WnF-rUbnU8MdWIZQYfggIHxBnW21I-lq_0HykLCdMpYj8d5joavWdxQ',
		vapidPrivateKey: env.VAPID_PRIVATE_KEY || 'JwxI_KcsBcehYcTOufMcbVWJjCq1QbH5FJmSyQuG680',
		vapidEmail: env.VAPID_EMAIL || 'mailto:admin@example.com'
	}
};
