<?php

declare(strict_types=1);

namespace App\Framework\Waf\ValueObjects;

/**
 * Technical context information
 */
final readonly class TechnicalContext
{
    public function __construct(
        public ?string $protocol = null,
        public ?string $tlsVersion = null,
        public ?string $cipherSuite = null,
        public ?int    $requestSize = null,
        public ?string $acceptLanguage = null,
        public ?string $acceptEncoding = null
    ) {
    }

    public function toArray(): array
    {
        return array_filter([
            'protocol' => $this->protocol,
            'tls_version' => $this->tlsVersion,
            'cipher_suite' => $this->cipherSuite,
            'request_size' => $this->requestSize,
            'accept_language' => $this->acceptLanguage,
            'accept_encoding' => $this->acceptEncoding,
        ], fn ($value) => $value !== null);
    }
}
