53 lines
1.6 KiB
PHP
53 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Contracts\Directories;
|
|
|
|
use App\Contracts\Directory;
|
|
use App\Dtos\CategoryProducts;
|
|
use Domain\Models\Entities\Product;
|
|
use Domain\Models\ValueObjects\Entities\ProductId;
|
|
use Domain\Models\ValueObjects\Entities\RecipeId;
|
|
use Domain\Models\ValueObjects\Pagination;
|
|
use Domain\Models\ValueObjects\Products\ProductCategory;
|
|
use Illuminate\Pagination\LengthAwarePaginator;
|
|
|
|
/** @extends Directory<int, \App\Models\Product> */
|
|
interface ProductDirectory extends Directory
|
|
{
|
|
public function find(ProductId $id): ?Product;
|
|
|
|
public function findBySlug(string $slug): ?Product;
|
|
|
|
/**
|
|
* @return \App\Dtos\ProductSummary[]
|
|
*/
|
|
public function getAllProductsSummary(): array;
|
|
|
|
/**
|
|
* @return LengthAwarePaginator<array-key,Product>
|
|
*/
|
|
public function getPaginatedProducts(
|
|
Pagination $pagination,
|
|
string $search = '',
|
|
): LengthAwarePaginator;
|
|
|
|
/**
|
|
* @param \Domain\Models\ValueObjects\Products\BreedingMethod[] $breedingMethods
|
|
* @param \Domain\Models\ValueObjects\Products\Technology[] $technologies
|
|
* @param \Domain\Models\ValueObjects\Products\Business[] $businesses
|
|
*/
|
|
public function getCategoryProducts(
|
|
ProductCategory $category,
|
|
array $breedingMethods = [],
|
|
array $technologies = [],
|
|
array $businesses = [],
|
|
?bool $isEgalim = null,
|
|
string $search = '',
|
|
int $limitPerCategory = 6
|
|
): ?CategoryProducts;
|
|
|
|
/** @return \Domain\Models\Entities\Product[] */
|
|
public function getRelatedProducts(RecipeId $recipeId, int $limit = 4): array;
|
|
}
|