<?php

namespace App\Policies;

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

class TransactionPolicy
{
    public function before(User $user, string $ability): bool|null
    {
        return $user->hasRole('super-admin') ? true : null;
    }

    public function viewAny(User $user): bool
    {
        return $user->can('transactions.view');
    }

    public function manualRequery(User $user, Transaction $transaction): bool
    {
        return $user->can('transactions.requery');
    }

    public function refund(User $user, Transaction $transaction): bool
    {
        return $user->can('transactions.refund');
    }
}

