<?php

declare(strict_types=1);

namespace App\Framework\Waf\ValueObjects;

/**
 * Business context information
 */
final readonly class BusinessContext
{
    public function __construct(
        public ?string $application = null,
        public ?string $environment = null,
        public ?string $tenant = null,
        public ?string $apiVersion = null,
        public ?string $feature = null,
        public ?array  $businessRules = null
    ) {
    }

    public function toArray(): array
    {
        return array_filter([
            'application' => $this->application,
            'environment' => $this->environment,
            'tenant' => $this->tenant,
            'api_version' => $this->apiVersion,
            'feature' => $this->feature,
            'business_rules' => $this->businessRules,
        ], fn ($value) => $value !== null);
    }
}
