28 lines
689 B
PHP
28 lines
689 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Modules\Inventory\Domain\Contracts;
|
|
|
|
use App\Modules\Inventory\Domain\Entities\StockItem;
|
|
|
|
interface StockItemRepository
|
|
{
|
|
public function findById(int $id): ?StockItem;
|
|
|
|
/**
|
|
* The item, locked until the end of the transaction, so that its
|
|
* balance and average cost change one movement at a time.
|
|
*/
|
|
public function lockById(int $id): ?StockItem;
|
|
|
|
public function save(StockItem $item): StockItem;
|
|
|
|
public function isNameTaken(string $name, ?int $exceptId = null): bool;
|
|
|
|
/**
|
|
* The value of all stock: each item's balance at its average cost.
|
|
*/
|
|
public function stockValueCents(): int;
|
|
}
|