<?php
namespace Incoviba\Common\Define;

use Incoviba\Common\Implement\Exception\EmptyResult;
use PDOException;

interface Repository
{
    /**
     * @param array|null $data
     * @return Model
     */
    public function create(?array $data = null): Model;

    /**
     * @param Model $model
     * @return Model
     * @throws PDOException
     */
    public function save(Model $model): Model;

    /**
     * @param array $data_row
     * @return Model
     */
    public function load(array $data_row): Model;

    /**
     * @param Model $model
     * @param array $new_data
     * @return Model
     * @throws EmptyResult
     */
    public function edit(Model $model, array $new_data): Model;

    /**
     * @param Model $model
     * @return void
     * @throws PDOException
     */
    public function remove(Model $model): void;
}
