public function onKernelResponse(FilterResponseEvent $event): void
    {
        $link = new Link('mercure', $this->hub);

        $attributes = $event->getRequest()->attributes;
        if (
            null === ($resourceClass = $attributes->get('_api_resource_class')) ||
            false === $this->resourceMetadataFactory->create($resourceClass)->getAttribute('mercure', false)
        ) {
            return;
        }

        if (null === $linkProvider = $attributes->get('_links')) {
            $attributes->set('_links', new GenericLinkProvider([$link]));

            return;
        }

        $attributes->set('_links', $linkProvider->withLink($link));
    }