. */ namespace SP\Domain\Security\Ports; use SP\Domain\Core\Dtos\ItemSearchDto; use SP\Domain\Core\Exceptions\ConstraintException; use SP\Domain\Core\Exceptions\QueryException; use SP\Domain\Security\Models\Track as TrackModel; use SP\Infrastructure\Database\QueryResult; /** * Class TrackRepository * * @template T of TrackModel */ interface TrackRepository { /** * @param TrackModel $track * * @return QueryResult * @throws ConstraintException * @throws QueryException */ public function add(TrackModel $track): QueryResult; /** * @param $id int * * @return int * @throws QueryException * @throws ConstraintException */ public function unlock(int $id): int; /** * Clears tracks * * @return bool con el resultado * @throws QueryException * @throws ConstraintException */ public function clear(): bool; /** * Devuelve los tracks de un cliente desde un tiempo y origen determinados * * @param TrackModel $track * * @return QueryResult * @throws ConstraintException * @throws QueryException */ public function getTracksForClientFromTime(TrackModel $track): QueryResult; /** * Searches for items by a given filter * * @param ItemSearchDto $itemSearchData * @param int $time The time to decide whether the track has been tracked or not. * If the track time is equal or greater than $time, it's considered as tracked. * @return QueryResult */ public function search(ItemSearchDto $itemSearchData, int $time): QueryResult; }