/*
* Calendula - An assistant for personal medication management.
* Copyright (C) 2016 CITIUS - USC
*
* Calendula is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software. If not, see <http://www.gnu.org/licenses/>.
*/
package es.usc.citius.servando.calendula.persistence;
import android.graphics.Color;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import es.usc.citius.servando.calendula.util.AvatarMgr;
/**
* Models an user
*/
@DatabaseTable(tableName = "Patients")
public class Patient {
public static final String COLUMN_ID = "_id";
public static final String COLUMN_NAME = "Name";
public static final String COLUMN_DEFAULT = "Default";
public static final String COLUMN_AVATAR = "Avatar";
public static final String COLUMN_COLOR = "Color";
@DatabaseField(columnName = COLUMN_ID, generatedId = true)
private Long id;
@DatabaseField(columnName = COLUMN_NAME)
private String name;
@DatabaseField(columnName = COLUMN_DEFAULT)
private boolean isDefault = false;
@DatabaseField(columnName = COLUMN_AVATAR)
private String avatar = AvatarMgr.DEFAULT_AVATAR;
@DatabaseField(columnName = COLUMN_COLOR)
private int color = Color.parseColor("#3498db"); // material blue 700 1976d2
public Long id() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String name() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isDefault() {
return isDefault;
}
public void setDefault(boolean isDefault) {
this.isDefault = isDefault;
}
public String avatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public void setColor(int color) {
this.color = color;
}
public int color(){
return color;
}
@Override
public String toString() {
return "Patient{" +
"id=" + id +
", name='" + name + '\'' +
", isDefault=" + isDefault +
", avatar='" + avatar + '\'' +
", color=" + color +
'}';
}
}