. */ namespace SP\Domain\Plugin; use SP\Core\Exceptions\ConstraintException; use SP\Core\Exceptions\QueryException; use SP\Core\Exceptions\SPException; use SP\DataModel\ItemData; use SP\DataModel\ItemSearchData; use SP\Infrastructure\Common\Repositories\NoSuchItemException; use SP\Infrastructure\Database\QueryResult; use SP\Infrastructure\Plugin\Repositories\PluginModel; /** * Class PluginService * * @package SP\Domain\Plugin\Services */ interface PluginServiceInterface { /** * Creates an item * * @throws ConstraintException * @throws QueryException */ public function create(PluginModel $itemData): int; /** * Updates an item * * @throws ConstraintException * @throws QueryException */ public function update(PluginModel $itemData): int; /** * Returns the item for given id * * @throws ConstraintException * @throws QueryException * @throws NoSuchItemException */ public function getById(int $id): PluginModel; /** * Returns all the items * * @return PluginModel[] * @throws ConstraintException * @throws QueryException */ public function getAll(): array; /** * Returns all the items for given ids * * @param int[] $ids * * @return PluginModel[] * @throws ConstraintException * @throws QueryException */ public function getByIdBatch(array $ids): array; /** * Deletes all the items for given ids * * @param int[] $ids * * @throws SPException * @throws ConstraintException * @throws QueryException * @throws SPException */ public function deleteByIdBatch(array $ids): void; /** * Deletes an item * * @throws SPException * @throws ConstraintException * @throws QueryException */ public function delete(int $id): void; /** * Searches for items by a given filter * * @throws ConstraintException * @throws QueryException */ public function search(ItemSearchData $itemSearchData): QueryResult; /** * Devuelve los datos de un plugin por su nombre * * @throws NoSuchItemException * @throws ConstraintException * @throws QueryException */ public function getByName(string $name): PluginModel; /** * Cambiar el estado del plugin * * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException * @throws \SP\Infrastructure\Common\Repositories\NoSuchItemException */ public function toggleEnabled(int $id, bool $enabled): void; /** * Cambiar el estado del plugin * * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException * @throws \SP\Infrastructure\Common\Repositories\NoSuchItemException */ public function toggleEnabledByName(string $name, bool $enabled): void; /** * Cambiar el estado del plugin * * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException * @throws \SP\Infrastructure\Common\Repositories\NoSuchItemException */ public function toggleAvailable(int $id, bool $available): void; /** * Cambiar el estado del plugin * * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException * @throws \SP\Infrastructure\Common\Repositories\NoSuchItemException */ public function toggleAvailableByName(string $name, bool $available): void; /** * Restablecer los datos de un plugin * * @throws NoSuchItemException * @throws ConstraintException * @throws QueryException */ public function resetById(int $id): bool; /** * Devolver los plugins activados * * @return ItemData[] * @throws ConstraintException * @throws QueryException */ public function getEnabled(): array; }