Bimba.git

ref: c1db5ac8fc4a50eb6c9f311c14b04c65a2654a24

app/src/main/java/xyz/apiote/bimba/czwek/repo/QrLocation.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
// 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.structs.QrLocationV1


enum class QrLocation {
	UNKNOWN, NONE, PATH, QUERY;

	companion object {
		fun of(q: QrLocationV1): QrLocation {
			return when (q) {
				QrLocationV1.UNKNOWN -> UNKNOWN
				QrLocationV1.NONE -> NONE
				QrLocationV1.PATH -> PATH
				QrLocationV1.QUERY -> QUERY
			}
		}
	}

	fun value(): UInt {
		return when (this) {
			UNKNOWN -> 0u
			NONE -> 1u
			PATH -> 2u
			QUERY -> 3u
		}
	}
}