<?php

namespace App\Modules\Procurement\Policies;

use App\Models\User;
use App\Modules\Procurement\Models\PurchaseOrder;

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

    public function view(User $user, PurchaseOrder $purchaseOrder): bool
    {
        return $user->can('procurement.purchase_orders.view', $purchaseOrder);
    }

    public function operate(User $user, PurchaseOrder $purchaseOrder): bool
    {
        return $user->can('procurement.purchase_orders.manage', $purchaseOrder);
    }

    public function createReceipt(User $user, PurchaseOrder $purchaseOrder): bool
    {
        return $user->can('procurement.goods_receipts.manage', $purchaseOrder);
    }
}
