<?php

namespace App\Blog\MessageHandler;

use App\Blog\Message\PublishScheduledBlogsMessage;
use App\Blog\Service\ScheduledBlogPublisher;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;

#[AsMessageHandler]
final class PublishScheduledBlogsHandler
{
    public function __construct(private readonly ScheduledBlogPublisher $publisher) {}

    public function __invoke(PublishScheduledBlogsMessage $message): void
    {
        $this->publisher->publishDue();
    }
}
