<?php

namespace App\Repositories;

use App\Interfaces\PageRepositoryInterface;
use App\Services\SettingsService;
use App\Services\ContentService;
use App\Services\PaginateService;

class PageRepository implements PageRepositoryInterface
{
    protected $content;
    protected $setttings;
    protected $paginate;
    protected $pages;

    public function __construct(
        ContentService $contentService,
        SettingsService $settingsService,
        PaginateService $paginateService
    ) {
        $this->content  = $contentService;
        $this->settings = $settingsService;
        $this->paginate = $paginateService;
        $this->pages    = $this->content->loadAllPages();
    }

    public function getAll()
    {
        return $this->pages;
    }

    public function getById($uuid)
    {
        return $this->pages->where('uuid', $uuid);
    }

    public function delete($uuid)
    {
    }

    public function create(array $page)
    {
    }

    public function update($uuid, array $page)
    {
    }

    public function getGroup($num, $limit, $sort = "all")
    {
        return $this->paginate->getPage($num, $limit, $sort);
    }
}