<?php

namespace App\Policies;

use App\Models\LoanProduct;
use App\Models\User;
use App\Support\Authorization\PermissionName;

class LoanProductPolicy
{
    public function viewAny(User $user): bool
    {
        return $user->can(PermissionName::LOAN_PRODUCTS_VIEW->value);
    }

    public function view(User $user, LoanProduct $loanProduct): bool
    {
        return $user->can(PermissionName::LOAN_PRODUCTS_VIEW->value);
    }

    public function create(User $user): bool
    {
        return $user->can(PermissionName::LOAN_PRODUCTS_MANAGE->value);
    }

    public function update(User $user, LoanProduct $loanProduct): bool
    {
        return $user->can(PermissionName::LOAN_PRODUCTS_MANAGE->value);
    }

    public function preview(User $user, LoanProduct $loanProduct): bool
    {
        return $user->can(PermissionName::LOAN_PRODUCTS_VIEW->value);
    }
}
