/*
 * F7cloud Talk - Android Client
 *
 * SPDX-FileCopyrightText: 2022 Nextcloud GmbH
 * SPDX-FileCopyrightText: 2022 Álvaro Brey <alvaro@alvarobrey.com>
 * SPDX-License-Identifier: GPL-3.0-or-later
 */
package ru.f7cloud.talk.test.fakes

import ru.f7cloud.talk.models.domain.SearchMessageEntry
import ru.f7cloud.talk.repositories.unifiedsearch.UnifiedSearchRepository
import io.reactivex.Observable

class FakeUnifiedSearchRepository : UnifiedSearchRepository {

    lateinit var response: UnifiedSearchRepository.UnifiedSearchResults<SearchMessageEntry>
    var lastRequestedCursor = -1

    override fun searchMessages(
        credentials: String?,
        url: String,
        searchTerm: String,
        cursor: Int,
        limit: Int
    ): Observable<UnifiedSearchRepository.UnifiedSearchResults<SearchMessageEntry>> {
        lastRequestedCursor = cursor
        return Observable.just(response)
    }

    override fun searchInRoom(
        credentials: String?,
        url: String,
        roomToken: String,
        searchTerm: String,
        cursor: Int,
        limit: Int
    ): Observable<UnifiedSearchRepository.UnifiedSearchResults<SearchMessageEntry>> {
        lastRequestedCursor = cursor
        return Observable.just(response)
    }
}
