<?php

declare(strict_types=1);

/*
 * This file is part of the VITICORE2 package.
 *
 * (c) CP Creation <web@cpcreation.fr>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace CpCreation\VitiCore\Bridge\Symfony\Bundle\Scheduler;

use CpCreation\VitiCore\Bridge\Symfony\Bundle\Messenger\Messaging\CommandHandlerInterface;
use CpCreation\VitiCore\Marketing\ReviewDataRetentionPurger;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;

#[AsMessageHandler]
final readonly class PurgeReviewDataMessageHandler implements CommandHandlerInterface
{
    public function __construct(
        private ReviewDataRetentionPurger $purger,
    ) {}

    public function __invoke(PurgeReviewDataMessage $message): void
    {
        $this->purger->purge();
    }
}
