<?php

namespace App\Policies;

use App\Models\Transaction;
use App\Models\User;

class TransactionPolicy
{
    public function viewAny(User $user): bool
    {
        return $user->is_admin === true;
    }

    public function view(User $user, Transaction $transaction): bool
    {
        return $user->is_admin === true;
    }

    public function refund(User $user, Transaction $transaction): bool
    {
        return $user->is_admin === true && $transaction->isSuccessful();
    }
}
