<?php
namespace ShopyPress\Config;
if ( ! defined( 'ABSPATH' ) ) exit;

class SyncConfig {
    const SYNC_BATCH_SIZE = 20;
    const SYNC_MAX_EXECUTION_TIME_RATIO = 0.7;
    const SYNC_STATE_OPTION_KEY = 'shopypress_sync_state';
    const SYNC_LAST_STATE_OPTION_KEY = 'shopypress_sync_last_state';
    const SHOPIFY_PRODUCTS_PER_PAGE = 250;
    const SHOPIFY_VARIANTS_PER_PRODUCT = 100;
    const SHOPIFY_IMAGES_PER_PRODUCT = 20;

    /**
     * Get maximum execution time for sync operations
     * Returns 70% of PHP max_execution_time to provide safety buffer
     */
    public static function getMaxExecutionTime(): int {
        $max_time = ini_get('max_execution_time');

        // If unlimited (0) or not set, use 30 seconds as default
        if (empty($max_time)) {
            $max_time = 30;
        }

        // Apply 70% safety buffer
        return (int)($max_time * self::SYNC_MAX_EXECUTION_TIME_RATIO);
    }
}
