<?php

namespace Modules\Admin\Services;

use Illuminate\Pagination\LengthAwarePaginator;
use Modules\Admin\Repositories\Interfaces\BasketItemRepositoryInterface;

class BasketItemService
{
    public function __construct(
        private BasketItemRepositoryInterface $basketItemRepository
    ) {}

    public function getAll(int $perPage = 10): LengthAwarePaginator
    {
        return $this->basketItemRepository->paginate($perPage);
    }

    public function findById(int $id): ?\Modules\Basket\Models\BasketItem
    {
        return $this->basketItemRepository->find($id);
    }

    public function delete(int $id): bool
    {
        return $this->basketItemRepository->delete($id);
    }
}
