package com.luticate.auth.dbo;

import com.luticate.utils.dbo.LuDbo;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.HashMap;

/**
 * Created by robin on 11/27/15.
 */
public class LuLoginDbo extends LuDbo {

    private String _username;

    private String _firstname;

    private String _lastname;

    private String _email;

    private String _token;

    private int _id;

    private Integer _profileId;

    @Override
    public HashMap<String, Object> toArray() {
        HashMap<String, Object> array = new HashMap<>();
        array.put("Username", _username);
        array.put("Email", _email);
        array.put("Firstname", _firstname);
        array.put("Lastname", _lastname);
        array.put("Token", _token);
        array.put("Id", _id);
        array.put("ProfileId", _profileId);
        return array;
    }

    @Override
    public void fromJson(JSONObject json) throws JSONException {
        _username = json.getString("Username");
        _email = json.getString("Email");
        _firstname = json.getString("Firstname");
        _lastname = json.getString("Lastname");
        _token = json.getString("Token");
        _id = json.getInt("Id");
        try
        {
            _profileId = json.getInt("ProfileId");
        } catch (Exception e) {

        }
    }

    public String getUsername() {
        return _username;
    }

    public void setUsername(String username) {
        _username = username;
    }

    public String getFirstname() {
        return _firstname;
    }

    public void setFirstname(String firstname) {
        _firstname = firstname;
    }

    public String getLastname() {
        return _lastname;
    }

    public void setLastname(String lastname) {
        _lastname = lastname;
    }

    public String getEmail() {
        return _email;
    }

    public void setEmail(String email) {
        _email = email;
    }

    public String getToken() {
        return _token;
    }

    public void setToken(String token) {
        _token = token;
    }

    public int getId() {
        return _id;
    }

    public void setId(int id) {
        _id = id;
    }

    public Integer getProfileId() {
        return _profileId;
    }

    public void setProfileId(Integer profileId) {
        _profileId = profileId;
    }
}
