package de.beyondsoft.ownchat.data.repository.models;

import de.beyondsoft.ownchat.model.User;

import io.realm.RealmObject;
import io.realm.annotations.PrimaryKey;

/**
 * Created by imarneanu on 3/6/17.
 */
public class UserRealm extends RealmObject {
    public static final String ID = "id";
    public static final String FIRST_NAME = "firstName";

    @PrimaryKey
    private long id;
    private String firstName;
    private String lastName;
    private String avatar;
    private String mobile;
    private boolean isEmployee;

    public UserRealm() {
    }

    public UserRealm(long id,
                     String firstName,
                     String lastName,
                     String avatar,
                     String mobile,
                     boolean isEmployee) {
        this.id = id;
        this.firstName = firstName;
        this.lastName = lastName;
        this.avatar = avatar;
        this.mobile = mobile;
        this.isEmployee = isEmployee;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getId() {
        return id;
    }

    public String getFirstName() {
        return firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public String getAvatar() {
        return avatar;
    }

    public String getMobile() {
        return mobile;
    }

    public boolean isEmployee() {
        return isEmployee;
    }

    public static UserRealm createFromUser(User user) {
        if (user == null) {
            return null;
        }
        return new UserRealm(user.id, user.firstName, user.lastName, user.avatar, user.mobile, user.isEmployee);
    }
}
