<?php

namespace App\Policies;

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

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

    public function view(User $user, PaymentTransaction $transaction): bool
    {
        return $this->access->scopeAppointments(
            $transaction->appointment()->getQuery(),
            $user
        )->exists();
    }
}
