<?php

declare(strict_types=1);

namespace App\Listeners\Achievements;

use App\Events\Achievements\AchievementCheckRequested;
use App\Events\Achievements\UserXpUpdated;
use App\Services\AchievementService;

class CheckUserAchievements
{
    public function __construct(private readonly AchievementService $achievements) {}

    public function handle(AchievementCheckRequested|UserXpUpdated $event): void
    {
        $this->achievements->checkAchievements($event->userId);
    }
}