<?php

declare(strict_types=1);

namespace ApiModel\Domain\Repository;

interface InventoryRepositoryInterface
{
    // --- Categories ---
    public function findCategoryById(string $id): ?array;
    
    /** @return list<array<string, mixed>> */
    public function listCategories(string $companyId): array;
    
    public function insertCategory(string $id, string $companyId, string $name, ?string $description): void;
    
    public function updateCategory(string $id, string $name, ?string $description): void;
    
    public function deleteCategory(string $id): void;
    
    public function categoryNameExists(string $companyId, string $name, ?string $excludeId = null): bool;

    // --- Items ---
    public function findItemById(string $id): ?array;
    
    public function findItemBySku(string $companyId, string $sku): ?array;
    
    /** @return list<array<string, mixed>> */
    public function listItems(string $companyId): array;
    
    public function insertItem(array $data): void;
    
    public function updateItem(string $id, array $data): void;
    
    public function deleteItem(string $id): void;
    
    public function itemSkuExists(string $companyId, string $sku, ?string $excludeId = null): bool;

    // --- Warehouses ---
    public function findWarehouseById(string $id): ?array;
    
    public function findWarehouseByCode(string $companyId, string $code): ?array;
    
    /** @return list<array<string, mixed>> */
    public function listWarehouses(string $companyId): array;
    
    public function insertWarehouse(string $id, string $companyId, string $name, string $code, ?string $address): void;
    
    public function updateWarehouse(string $id, string $name, string $code, ?string $address, bool $isActive): void;
    
    public function deleteWarehouse(string $id): void;
    
    public function warehouseCodeExists(string $companyId, string $code, ?string $excludeId = null): bool;

    // --- Stock ---
    public function getStock(string $itemId, string $warehouseId): float;
    
    public function updateStock(string $itemId, string $warehouseId, float $quantity): void;
    
    /** @return list<array<string, mixed>> */
    public function listStockByItem(string $itemId): array;
    
    /** @return list<array<string, mixed>> */
    public function listStockByWarehouse(string $warehouseId): array;
}
