<?php
namespace Incoviba\Common\Ideal\Service;

use Psr\Log\LoggerInterface;
use Incoviba\Common\Define;
use Incoviba\Common\Ideal;
use Incoviba\Exception\ServiceAction;

abstract class API extends Ideal\Service
{
    public function __construct(LoggerInterface $logger)
    {
        parent::__construct($logger);
    }

    /**
     * @param string|array|null $order
     * @return array
     */
    abstract public function getAll(null|string|array $order = null): array;

    /**
     * @param int $id
     * @return Define\Model
     * @throws ServiceAction\Read
     */
    abstract public function get(int $id): Define\Model;

    /**
     * @param array $data
     * @return Define\Model
     * @throws ServiceAction\Create
     */
    abstract public function add(array $data): Define\Model;

    /**
     * @param Define\Model $model
     * @param array $new_data
     * @return Define\Model
     * @throws ServiceAction\Update
     */
    abstract public function edit(Define\Model $model, array $new_data): Define\Model;

    /**
     * @param int $id
     * @return Define\Model
     * @throws ServiceAction\Delete
     */
    abstract public function delete(int $id): Define\Model;

    /**
     * @param Define\Model $model
     * @return Define\Model
     */
    abstract protected function process(Define\Model $model): Define\Model;
}
