Bimba.git

ref: 3877e1e462c33778518e8c48dbf9e53076c00a53

app/src/main/java/xyz/apiote/bimba/czwek/repo/Interfaces.kt


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// SPDX-FileCopyrightText: Adam Evyčędo
//
// SPDX-License-Identifier: GPL-3.0-or-later

package xyz.apiote.bimba.czwek.repo

import android.content.Context
import android.graphics.drawable.Drawable
import android.net.ConnectivityManager
import xyz.apiote.bimba.czwek.api.Server

interface Queryable
interface Locatable {
	fun icon(context: Context, scale: Float = 1f): Drawable
	fun location(): Position
	fun id(): String
}

interface Repository {
	suspend fun getFeeds(
		context: Context,
		server: Server = Server.get(context)
	): Map<String, FeedInfo>?

	suspend fun getDepartures(
		feedID: String,
		stop: String,
		line: String?,
		context: Context,
		limit: Int?
	): StopDepartures?

	suspend fun getLocatablesIn(
		cm: ConnectivityManager,
		bl: Position,
		tr: Position,
		context: Context
	): List<Locatable>?

	suspend fun getLine(
		cm: ConnectivityManager,
		feedID: String,
		line: String,
		context: Context
	): Line?

	suspend fun queryQueryables(
		query: String,
		context: Context
	): List<Queryable>?

	suspend fun locateQueryables(
		position: Position,
		context: Context
	): List<Queryable>?
}