<?php
/**
 * 2026 Paysera
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * @author Paysera <plugins@paysera.com>
 * @copyright 2026 Paysera
 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
 * International Registered Trademark & Property of Paysera
 */

declare(strict_types=1);

namespace Paysera\PrestashopPayments\Diagnostic\Config;

if (!defined('_PS_VERSION_')) {
    exit;
}

final class DiagnosticConfig
{
    public const MINIMUM_PHP_VERSION = '8.0';
    public const MINIMUM_PRESTASHOP_VERSION = '8.0.0';
    public const MEMORY_LIMIT = '128M';
    public const MAX_INPUT_VARS = 1000;
    public const POST_MAX_SIZE = '20M';
    public const DEFAULT_CHARSET = 'UTF-8';
    public const PUBLIC_KEY_URL = 'https://paysera.com/download/public.key';
    public const REQUEST_TIMEOUT_SECONDS = 5;
    public const REMOTE_FETCH_TIMEOUT_SECONDS = 15;

    /**
     * @var array<string, array{gte: string, lt: string}>
     */
    public const PHP_OPENSSL_COMPATIBILITY = [
        '8.0' => ['gte' => '1.0.1', 'lt' => '3.0'],
        '8.1' => ['gte' => '1.0.2', 'lt' => '4.0'],
        '8.2' => ['gte' => '1.0.2', 'lt' => '4.0'],
        '8.3' => ['gte' => '1.0.2', 'lt' => '4.0'],
        '8.4' => ['gte' => '1.0.2', 'lt' => '4.0'],
    ];

    /**
     * @return array<string, int|null>
     */
    public static function getTlsVersions(): array
    {
        return [
            'TLS 1.0' => defined('CURL_SSLVERSION_TLSv1_0') ? CURL_SSLVERSION_TLSv1_0 : null,
            'TLS 1.1' => defined('CURL_SSLVERSION_TLSv1_1') ? CURL_SSLVERSION_TLSv1_1 : null,
            'TLS 1.2' => defined('CURL_SSLVERSION_TLSv1_2') ? CURL_SSLVERSION_TLSv1_2 : null,
            'TLS 1.3' => defined('CURL_SSLVERSION_TLSv1_3') ? CURL_SSLVERSION_TLSv1_3 : null,
        ];
    }
}
