class RestrictionMosaicRepositoryOkHttpImpl extends AbstractRepositoryOkHttpImpl implements RestrictionMosaicRepository {

  @Override
  public Observable<Page<MosaicRestriction<?>>> search(MosaicRestrictionSearchCriteria criteria) {

    String mosaicId = criteria.getMosaicId() == null ? null : criteria.getMosaicId().getIdAsHex();
    MosaicRestrictionEntryTypeEnum entryType =
        criteria.getEntryType() == null
            ? null
            : MosaicRestrictionEntryTypeEnum.fromValue(criteria.getEntryType().getValue());
    String targetAddress = toDto(criteria.getTargetAddress());
    Integer pageSize = criteria.getPageSize();
    Integer pageNumber = criteria.getPageNumber();
    String offset = criteria.getOffset();
    Order order = toDto(criteria.getOrder());

    Callable<MosaicRestrictionsPage> callback =
        () ->
            getClient()
                .searchMosaicRestriction(
                    mosaicId, entryType, targetAddress, pageSize, pageNumber, offset, order);

    return call(
        callback,
        page ->
            toPage(
                page.getPagination(),
                page.getData().stream()
                    .map(this::toMosaicRestriction)
                    .collect(Collectors.toList())));
  }

  public  RestrictionMosaicRepositoryOkHttpImpl(ApiClient apiClient);

}