<?php

namespace Modules\Admin\Services;

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

class SaveTheFoodProductService
{
    public function __construct(
        private SaveTheFoodProductRepositoryInterface $saveTheFoodProductRepository
    ) {}

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

    public function findById(int $id): ?\Modules\SaveTheFood\Models\SaveTheFoodProduct
    {
        return $this->saveTheFoodProductRepository->find($id);
    }

    public function create(array $data): \Modules\SaveTheFood\Models\SaveTheFoodProduct
    {
        return $this->saveTheFoodProductRepository->create($data);
    }

    public function update(int $id, array $data): \Modules\SaveTheFood\Models\SaveTheFoodProduct
    {
        return $this->saveTheFoodProductRepository->update($id, $data);
    }

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