<?php
/**
 * WPForms to Mailjet Automation Configuration Sample
 * 
 * Copy this file to 'wpfmj-config.php' to customize plugin settings.
 * The wpfmj-config.php file will be ignored by version control.
 * 
 * @package    WPFMJ
 */

// If this file is called directly, abort.
if (!defined('WPINC')) {
    die;
}

/**
 * Error Log Retention Period
 * 
 * Number of days to keep resolved error logs before automatic cleanup.
 * Default: 90 days
 * Minimum: 7 days
 * Recommended: 30-180 days
 * 
 * Example: Keep errors for 180 days (6 months)
 */
add_filter('wpfmj_error_log_retention_days', function($days) {
    return 180; // Change this value to your preference
});

/**
 * API Rate Limit
 * 
 * Maximum number of Mailjet API requests per minute per API key.
 * Default: 60 requests per minute
 * Minimum: 10 requests per minute
 * Maximum: 300 requests per minute (Mailjet limit)
 * 
 * Note: Lowering this value increases reliability but may slow down
 * high-volume form submissions. Increase cautiously to avoid hitting
 * Mailjet's rate limits.
 */
add_filter('wpfmj_api_rate_limit', function($limit) {
    return 60; // Change this value to your preference
});

/**
 * Maximum Retry Attempts
 * 
 * Number of times to retry failed Mailjet API calls before giving up.
 * Default: 3 attempts
 * Minimum: 1 attempt
 * Maximum: 5 attempts
 * 
 * Each retry uses exponential backoff: 1s, 2s, 4s, 8s, 16s
 */
add_filter('wpfmj_max_retry_attempts', function($attempts) {
    return 3; // Change this value to your preference
});

/**
 * Email Notification Recipients
 * 
 * Email addresses to notify when automation failures occur.
 * Default: WordPress admin email
 * 
 * Example: Send to multiple admins
 */
add_filter('wpfmj_failure_notification_emails', function($emails) {
    // Return array of email addresses
    return array(
        get_option('admin_email'),
        'developer@example.com',
        'support@example.com'
    );
});

/**
 * Disable Admin Email Notifications
 * 
 * Set to true to disable email notifications for automation failures.
 * Default: false (notifications enabled)
 * 
 * Note: Even when disabled, failures are still logged in the database
 * and visible in the WordPress admin dashboard.
 */
add_filter('wpfmj_disable_failure_notifications', function($disabled) {
    return false; // Set to true to disable notifications
});

/**
 * Custom Encryption Algorithm
 * 
 * Advanced users only: Change the encryption method for API credentials.
 * Default: AES-256-CBC
 * 
 * Warning: Changing this after credentials are stored will prevent
 * decryption of existing credentials. Only change before first use.
 * 
 * Supported methods: openssl_get_cipher_methods()
 */
add_filter('wpfmj_encryption_method', function($method) {
    return 'AES-256-CBC'; // Change with caution
});

/**
 * Debug Mode
 * 
 * Enable verbose logging for troubleshooting.
 * Default: false
 * 
 * When enabled, additional debug information will be written to the
 * WordPress debug log. Only enable when troubleshooting issues.
 */
add_filter('wpfmj_debug_mode', function($debug) {
    return false; // Set to true for verbose logging
});

/**
 * Cron Schedule
 * 
 * Change the frequency of error log cleanup.
 * Default: 'weekly'
 * 
 * Options: 'hourly', 'twicedaily', 'daily', 'weekly'
 */
add_filter('wpfmj_cleanup_schedule', function($schedule) {
    return 'weekly'; // Change to your preference
});
