<?php

declare(strict_types=1);

namespace App\Policies;

use App\Models\BankCard;
use App\Models\User;

class BankCardPolicy
{
    public function viewAny(User $user): bool
    {
        return true;
    }

    public function view(User $user, BankCard $bankCard): bool
    {
        return $user->hasRole('admin') || $bankCard->user_id === $user->id;
    }

    public function create(User $user): bool
    {
        return true;
    }

    public function update(User $user, BankCard $bankCard): bool
    {
        return $user->hasRole('admin') || $bankCard->user_id === $user->id;
    }

    public function delete(User $user, BankCard $bankCard): bool
    {
        return $user->hasRole('admin') || $bankCard->user_id === $user->id;
    }
}
