<?php

namespace App\Policies;

use App\Models\QueueEntry;
use App\Models\User;
use App\Services\AccessService;

class QueueEntryPolicy
{
    public function __construct(private readonly AccessService $access) {}

    public function view(User $user, QueueEntry $entry): bool
    {
        return $this->access->scopeQueue(
            QueueEntry::query()->whereKey($entry->id),
            $user
        )->exists();
    }

    public function update(User $user, QueueEntry $entry): bool
    {
        return $this->view($user, $entry);
    }
}
