<?php

namespace App\Appointment\MessageHandler;

use App\Appointment\Message\ExpireAppointmentsMessage;
use App\Appointment\Service\AppointmentExpiryService;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;

#[AsMessageHandler]
final class ExpireAppointmentsHandler
{
    public function __construct(private readonly AppointmentExpiryService $expiryService) {}

    public function __invoke(ExpireAppointmentsMessage $message): void
    {
        $this->expiryService->expireStale();
    }
}
