<?php
/**
 * Created by PhpStorm.
 * User: radko
 * Date: 23.7.18
 * Time: 14:57
 */

namespace Seka\Vzdelavanie\Repositories\Contracts;

/**
 * Interface RepositoryInterface
 * @package Seka\Vzdelavanie\Repositories\Contracts
 */
interface RepositoryInterface
{
    /**
     * @param array $attributes
     * @return mixed
     */
    public function make(array $attributes);

    /**
     * @param array $attributes
     * @return mixed
     */
    public function create(array $attributes);

    /**
     * @param array  $attributes
     * @param int    $id
     * @param string $attribute
     * @return mixed
     * @throws \Seka\Vzdelavanie\Repositories\Exceptions\ModelNotFoundException
     */
    public function update(array $attributes, int $id, $attribute = 'id');

    /**
     * @param int $id
     * @return mixed
     * @throws \Seka\Vzdelavanie\Repositories\Exceptions\ModelNotFoundException
     */
    public function delete(int $id);

    /**
     * @return mixed
     */
    public function query();

    /**
     * @param array $columns
     * @return mixed
     */
    public function all(array $columns = array('*'));

    /**
     * @param int   $perPage
     * @param array $columns
     * @return mixed
     */
    public function paginate(int $perPage = 15, array $columns = array('*'));

    /**
     * @param int   $id
     * @param array $columns
     * @return mixed
     * @throws \Seka\Vzdelavanie\Repositories\Exceptions\ModelNotFoundException
     */
    public function find(int $id, array $columns = array('*'));

    /**
     * @param string $field
     * @param mixed  $value
     * @param array  $columns
     * @return mixed
     * @throws \Seka\Vzdelavanie\Repositories\Exceptions\ModelNotFoundException
     */
    public function findBy(string $field, $value, array $columns = array('*'));

    /**
     * @param string $field
     * @param        $value
     * @param array  $columns
     * @return $this
     */
    public function where(string $field, $value, array $columns = array('*'));

    /**
     * @param string $fieldName
     * @param string $value
     * @return $this
     */
    public function orderBy(string $fieldName, string $value);

    /**
     * @param int|null $value
     * @return $this
     */
    public function limit(int $value = null);

    /**
     * @param string|array $relations
     * @return $this
     */
    public function with($relations);

    /**
     * @param $relations
     * @return $this
     */
    public function withCount($relations);
}
