2 * Copyright © 2021 Damyan Ivanov.
3 * This file is part of MoLe.
4 * MoLe is free software: you can distribute it and/or modify it
5 * under the term of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your opinion), any later version.
9 * MoLe is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License terms for details.
14 * You should have received a copy of the GNU General Public License
15 * along with MoLe. If not, see <https://www.gnu.org/licenses/>.
18 package net.ktnx.mobileledger.db;
20 import androidx.annotation.NonNull;
21 import androidx.room.ColumnInfo;
22 import androidx.room.Entity;
23 import androidx.room.ForeignKey;
24 import androidx.room.Index;
25 import androidx.room.PrimaryKey;
28 @Entity(tableName = "account_values", indices = {
29 @Index(name = "un_account_values", unique = true, value = {"account_id", "currency"}),
30 @Index(name = "fk_account_value_acc", value = "account_id")
32 @ForeignKey(entity = Account.class, parentColumns = "id", childColumns = "account_id",
33 onDelete = ForeignKey.CASCADE, onUpdate = ForeignKey.RESTRICT)
35 public class AccountValue {
37 @PrimaryKey(autoGenerate = true)
39 @ColumnInfo(name = "account_id")
40 private long accountId;
42 @ColumnInfo(defaultValue = "")
43 private String currency = "";
46 @ColumnInfo(defaultValue = "0")
47 private long generation = 0;
51 public void setId(long id) {
54 public long getAccountId() {
57 public void setAccountId(long accountId) {
58 this.accountId = accountId;
61 public String getCurrency() {
64 public void setCurrency(@NonNull String currency) {
65 this.currency = currency;
67 public float getValue() {
70 public void setValue(float value) {
73 public long getGeneration() {
76 public void setGeneration(long generation) {
77 this.generation = generation;