. */ namespace SP\Domain\Client\Ports; use SP\DataModel\ItemSearchData; use SP\Domain\Account\Ports\AccountFilterBuilder; use SP\Domain\Client\Models\Client as ClientModel; use SP\Domain\Common\Ports\RepositoryInterface; use SP\Domain\Core\Exceptions\ConstraintException; use SP\Domain\Core\Exceptions\QueryException; use SP\Domain\Core\Exceptions\SPException; use SP\Infrastructure\Common\Repositories\DuplicatedItemException; use SP\Infrastructure\Database\QueryResult; /** * Class ClientRepository * * @template T of ClientModel */ interface ClientRepository extends RepositoryInterface { /** * Creates an item * * @param ClientModel $client * * @return QueryResult * @throws DuplicatedItemException * @throws SPException */ public function create(ClientModel $client): QueryResult; /** * Updates an item * * @param ClientModel $client * * @return int * @throws ConstraintException * @throws QueryException * @throws DuplicatedItemException */ public function update(ClientModel $client): int; /** * Returns the item for given id * * @param int $clientId * * @return QueryResult */ public function getById(int $clientId): QueryResult; /** * Deletes all the items for given ids * * @param array $clientIds * * @return QueryResult * @throws ConstraintException * @throws QueryException */ public function deleteByIdBatch(array $clientIds): QueryResult; /** * Deletes an item * * @param int $id * * @return QueryResult * @throws ConstraintException * @throws QueryException */ public function delete(int $id): QueryResult; /** * Searches for items by a given filter * * @param ItemSearchData $itemSearchData * * @return QueryResult */ public function search(ItemSearchData $itemSearchData): QueryResult; /** * Returns the item for given name * * @param string $name * * @return QueryResult * @throws QueryException * @throws ConstraintException */ public function getByName(string $name): QueryResult; /** * Return the clients visible for the current user * * @param AccountFilterBuilder $accountFilterUser * @return QueryResult * @throws QueryException * @throws ConstraintException */ public function getAllForFilter(AccountFilterBuilder $accountFilterUser): QueryResult; /** * Returns all the items * * @return QueryResult */ public function getAll(): QueryResult; }