<?php

namespace Modules\Category\Services;

use Illuminate\Http\Request;
use Modules\Category\Interfaces\CategoryRepositoryInterface;
use Modules\Category\Models\Category;

class CategoryService
{
    private CategoryRepositoryInterface $categoryRepository ;

    public function __construct(CategoryRepositoryInterface $categoryRepository)
    {
        $this->categoryRepository = $categoryRepository;
    }

    public function get(Request $request)
    {
        $categories = $this->categoryRepository->get($request);
        return $categories;
    }
    public function getItem(Category $category)
    {
        $category = $this->categoryRepository->getItem($category);
        return $category;
    }
    public function save(Request $request, ?Category $category): Category
    {
        $category = $this->categoryRepository->save($request,$category);
        return $category;
    }
    public function addVisit(Category $category):void
    {
        $this->categoryRepository->addVisit($category);
    }
    public function destroy(Request $request, int $id): array
    {
        $response = $this->categoryRepository->destroy($request,$id);
        return $response;
    }
    public function destroyAll(Request $request): array
    {
        $response = $this->categoryRepository->destroyAll($request);
        return $response;
    }
    public function restore(Request $request, int $id): array
    {
        $response = $this->categoryRepository->restore($request,$id);
        return $response;
    }
    public function restoreAll(Request $request): array
    {
        $response = $this->categoryRepository->restoreAll($request);
        return $response;
    }

}
