<?php

namespace Modules\Page\Services;

use Illuminate\Http\Request;
use Modules\Page\Interfaces\PageRepositoryInterface;
use Modules\Page\Models\Page;

class PageService
{
    private PageRepositoryInterface $pageRepository ;

    public function __construct(PageRepositoryInterface $pageRepository)
    {
        $this->pageRepository = $pageRepository;
    }

    public function get(Request $request)
    {
        $pages= $this->pageRepository->get($request);
        return $pages;
    }
    public function getItem(Page $page)
    {
        $page = $this->pageRepository->getItem($page);
        return $page;
    }
    public function getItemById(int $id)
    {
        $page = $this->pageRepository->getItemById($id);
        return $page;
    }
    public function save(Request $request, ?Page $page): Page
    {
        $page = $this->pageRepository->save($request,$page);
        return $page;
    }
}
