<?php

namespace Modules\Vrc\Services\Contracts;

use Modules\Vrc\Entities\VrcRepairOrder;

/**
 * VRC ↔ ERP inventory boundary (spec §6.7). VRC consumes ERP stock for the
 * stock-source parts on a repair order and reads availability/low-stock — it
 * never maintains its own inventory.
 */
interface StockServiceContract
{
    /**
     * Consume ERP stock for every not-yet-consumed stock-source part on the
     * order (decreases qty_available, marks the line). Returns the count.
     */
    public function consumeForOrder(VrcRepairOrder $ro): int;

    /** Available quantity for an ERP product/variation at a location. */
    public function available(int $businessId, int $productId, int $variationId, int $locationId): float;

    /** Low-stock rows for the dashboard widget (ERP inventory). */
    public function lowStock(int $businessId, ?int $locationId = null, int $limit = 10): array;
}
