Bimba.git

ref: 69173a3d7b96203c44ff3114a13da1feed7eccfc

app/src/main/java/xyz/apiote/bimba/czwek/repo/Journey.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
// SPDX-FileCopyrightText: Adam Evyčędo
//
// SPDX-License-Identifier: GPL-3.0-or-later

package xyz.apiote.bimba.czwek.repo

import xyz.apiote.bimba.czwek.api.transitous.model.Place
import xyz.apiote.bimba.czwek.units.DistanceUnit
import xyz.apiote.bimba.czwek.units.TimeUnit
import java.time.ZonedDateTime

data class Journey(val startTime: ZonedDateTime, val endTime: ZonedDateTime, val legs: List<Leg>)

data class Leg(
	val start: Event,
	val end: Event,
	val origin: xyz.apiote.bimba.czwek.repo.Place,
	val destination: xyz.apiote.bimba.czwek.repo.Place,
	val agencyName: String?,
	val distance: DistanceUnit?,
	val duration: TimeUnit,
	val intermediateStops: List<xyz.apiote.bimba.czwek.repo.Place>,
	/* TODO
	val shape: EncodedPolyline,
	val rental: Rental?,
	val steps: List<StepInstruction>?,*/
)

class Place(val stop: Stop, val latitude: Double, val longitude: Double) {
	constructor(place: Place) : this(
		stop = Stop(place),
		latitude = place.lat.toDouble(),
		longitude = place.lon.toDouble()
	)

	fun planString(): String = if (stop.code == "") {
		"${latitude},${longitude},0"
	} else {
		stop.code
	}
}