Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
main ▾

Modern-Apps.git / travel / src / main / java / com / vayunmathur / travel / data / RecentSearch.kt

RecentSearch.kt37 lines · 1.3 KiBRaw
1package com.vayunmathur.travel.data
2
3import androidx.room3.Entity
4import androidx.room3.PrimaryKey
5
6/** Recent searches are flights-only now, but the column is kept for history. */
7enum class Vertical { FLIGHTS }
8
9/**
10 * A search the user has run, kept so the Home screen can offer one-tap
11 * re-runs. All fields needed to rebuild the query are stored as columns;
12 * [label] is a pre-rendered human summary for the chip.
13 */
14@Entity
15data class RecentSearch(
16 @PrimaryKey(autoGenerate = true) val id: Long = 0,
17 val vertical: String,
18 val label: String,
19 val origin: String? = null,
20 val destination: String? = null,
21 val depart: String? = null,
22 val returnDate: String? = null,
23 val adults: Int = 1,
24 val cabin: String = "economy",
25 /** Flight child ages (comma-separated, as searched); blank when none. */
26 val children: String = "",
27 /** Flight lap infants, as searched. */
28 val infants: Int = 0,
29 /** Flight connection cap, as searched (-1 = no cap). */
30 val maxConnections: Int = -1,
31 /** Stay room count, as searched. */
32 val rooms: Int = 1,
33 /** Stay search coordinates from the picked suggestion, when it carried any. */
34 val latitude: Double? = null,
35 val longitude: Double? = null,
36 val createdAt: Long = System.currentTimeMillis(),
37)