aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/RecentSearchQuery.java
blob: e554b1baadb9b53864c774cb121d579d06b2d59b (plain) (blame)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package ml.docilealligator.infinityforreddit.recentsearchquery;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.ForeignKey;

import ml.docilealligator.infinityforreddit.thing.SelectThingReturnKey;
import ml.docilealligator.infinityforreddit.account.Account;

@Entity(tableName = "recent_search_queries", primaryKeys = {"username", "search_query"},
        foreignKeys = @ForeignKey(entity = Account.class, parentColumns = "username",
                childColumns = "username", onDelete = ForeignKey.CASCADE))
public class RecentSearchQuery {
    @NonNull
    @ColumnInfo(name = "username")
    private String username;
    @NonNull
    @ColumnInfo(name = "search_query")
    private String searchQuery;
    @Nullable
    @ColumnInfo(name = "search_in_subreddit_or_user_name")
    private String searchInSubredditOrUserName;
    @Nullable
    @ColumnInfo(name = "search_in_multireddit_path")
    private String multiRedditPath;
    @Nullable
    @ColumnInfo(name = "search_in_multireddit_display_name")
    private String multiRedditDisplayName;
    @SelectThingReturnKey.THING_TYPE
    @ColumnInfo(name = "search_in_thing_type")
    private int searchInThingType;
    @ColumnInfo(name = "time")
    private long time;

    public RecentSearchQuery(@NonNull String username, @NonNull String searchQuery,
                             @Nullable String searchInSubredditOrUserName, @Nullable String multiRedditPath,
                             @Nullable String multiRedditDisplayName,
                             @SelectThingReturnKey.THING_TYPE int searchInThingType) {
        this.username = username;
        this.searchQuery = searchQuery;
        this.searchInSubredditOrUserName = searchInSubredditOrUserName;
        this.searchInThingType = searchInThingType;
        this.multiRedditPath = multiRedditPath;
        this.multiRedditDisplayName = multiRedditDisplayName;
        this.time = System.currentTimeMillis();
    }

    @NonNull
    public String getUsername() {
        return username;
    }

    public void setUsername(@NonNull String username) {
        this.username = username;
    }

    @NonNull
    public String getSearchQuery() {
        return searchQuery;
    }

    public void setSearchQuery(@NonNull String searchQuery) {
        this.searchQuery = searchQuery;
    }

    @Nullable
    public String getSearchInSubredditOrUserName() {
        return searchInSubredditOrUserName;
    }

    public void setSearchInSubredditOrUserName(@Nullable String searchInSubredditOrUserName) {
        this.searchInSubredditOrUserName = searchInSubredditOrUserName;
    }

    @Nullable
    public String getMultiRedditPath() {
        return multiRedditPath;
    }

    public void setMultiRedditPath(@Nullable String multiRedditPath) {
        this.multiRedditPath = multiRedditPath;
    }

    @Nullable
    public String getMultiRedditDisplayName() {
        return multiRedditDisplayName;
    }

    public void setMultiRedditDisplayName(@Nullable String multiRedditDisplayName) {
        this.multiRedditDisplayName = multiRedditDisplayName;
    }

    @SelectThingReturnKey.THING_TYPE
    public int getSearchInThingType() {
        return searchInThingType;
    }

    public void setSearchInThingType(@SelectThingReturnKey.THING_TYPE int searchInThingType) {
        this.searchInThingType = searchInThingType;
    }

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }
}