Bimba.git

ref: 409f8c666e49deb35b70006171a63b3aaaaae012

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
57
58
59
60
61
// 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 xyz.apiote.bimba.czwek.api.Server
import java.time.LocalDate

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

interface Repository {
	suspend fun getFavourite(stopCode: String): Favourite?
	suspend fun getFavourites(feedIDs: Set<String> = emptySet()): List<Favourite>

	suspend fun saveFavourite(favourite: Favourite)
	suspend fun saveFavourites(favourites: Set<Favourite>)

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

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

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

	suspend fun getLine(
		context: Context,
		feedID: String,
		lineName: String,
		lineID: String,
	): Line?

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

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