<?php

namespace Modules\Admin\Services;

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

class CartItemService
{
    public function __construct(
        private CartItemRepositoryInterface $cartItemRepository
    ) {}

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

    public function findById(int $id): ?\Modules\Cart\Models\CartItem
    {
        return $this->cartItemRepository->find($id);
    }

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