<?php

namespace App\Policies;

use App\Models\InventoryTransferDocument;
use App\Models\User;

/**
 * Documentos de transferencia inventario: lectura inventory.view|manage; mutación inventory.manage.
 */
class InventoryTransferDocumentPolicy
{
    public function viewAny(User $user): bool
    {
        return $user->can('inventory.view') || $user->can('inventory.manage');
    }

    public function view(User $user, InventoryTransferDocument $document): bool
    {
        return $this->viewAny($user);
    }

    public function create(User $user): bool
    {
        return $user->can('inventory.manage');
    }

    public function update(User $user, InventoryTransferDocument $document): bool
    {
        return $user->can('inventory.manage');
    }

    public function delete(User $user, InventoryTransferDocument $document): bool
    {
        return $user->can('inventory.manage');
    }

    public function confirm(User $user, InventoryTransferDocument $document): bool
    {
        return $user->can('inventory.manage');
    }

    public function cancelDraft(User $user, InventoryTransferDocument $document): bool
    {
        return $user->can('inventory.manage');
    }
}
