// Path: app/src/main/java/org/houxg/leamonax/service/AccountService.java
// public class AccountService {
// 
//     public static Observable<BaseResponse> register(String email, String password) {
//         return RetrofitUtils.create(ApiProvider.getInstance().getAuthApi().register(email, password));
//     }
// 
//     public static Observable<Authentication> login(String email, String password) {
//         return RetrofitUtils.create(ApiProvider.getInstance().getAuthApi().login(email, password));
//     }
// 
//     public static Observable<User> getInfo(String userId) {
//         return RetrofitUtils.create(ApiProvider.getInstance().getUserApi().getInfo(userId));
//     }
// 
//     public static long saveToAccount(Authentication authentication, String host) {
//         Account localAccount = AppDataBase.getAccount(authentication.getEmail(), host);
//         if (localAccount == null) {
//             localAccount = new Account();
//         }
//         localAccount.setHost(host);
//         localAccount.setEmail(authentication.getEmail());
//         localAccount.setAccessToken(authentication.getAccessToken());
//         localAccount.setUserId(authentication.getUserId());
//         localAccount.setUserName(authentication.getUserName());
//         localAccount.save();
//         return localAccount.getLocalUserId();
//     }
// 
//     public static void saveToAccount(User user, String host) {
//         Account localAccount = AppDataBase.getAccount(user.getEmail(), host);
//         if (localAccount == null) {
//             localAccount = new Account();
//         }
//         localAccount.setHost(host);
//         localAccount.setEmail(user.getEmail());
//         localAccount.setUserId(user.getUserId());
//         localAccount.setUserName(user.getUserName());
//         localAccount.setAvatar(user.getAvatar());
//         localAccount.setVerified(user.isVerified());
//         localAccount.save();
//     }
// 
//     public static void logout() {
//         Account account = getCurrent();
//         account.setAccessToken("");
//         account.update();
//     }
// 
//     public static Observable<BaseResponse> changePassword(String oldPassword, String newPassword) {
//         return RetrofitUtils.create(ApiProvider.getInstance().getUserApi().updatePassword(oldPassword, newPassword));
//     }
// 
//     public static Observable<BaseResponse> changeUserName(String userName) {
//         return RetrofitUtils.create(ApiProvider.getInstance().getUserApi().updateUsername(userName));
//     }
// 
//     public static Account getCurrent() {
//         return AppDataBase.getAccountWithToken();
//     }
// 
//     public static List<Account> getAccountList() {
//         return AppDataBase.getAccountListWithToken();
//     }
// 
//     public static Account getAccountById(long id) {
//         return new Select()
//                 .from(Account.class)
//                 .where(Account_Table.id.eq(id))
//                 .querySingle();
//     }
// 
//     public static boolean isSignedIn() {
//         return getCurrent() != null;
//     }
// }


import com.google.gson.annotations.SerializedName;
import com.raizlabs.android.dbflow.annotation.Column;
import org.houxg.leamonax.service.AccountService;
package org.houxg.leamonax.model;




public class User extends BaseResponse {

    @SerializedName("UserId")
    String userId = "";
    @SerializedName("Username")
    String userName = "";
    @Column(name = "email")
    @SerializedName("Email")
    String email = "";
    @SerializedName("Verified")
    boolean isVerified;
    @SerializedName("Logo")
    String avatar = "";

    public String getUserId() {
        return userId;
    }

    public String getUserName() {
        return userName;
    }

    public String getEmail() {
        return email;
    }

    public boolean isVerified() {
        return isVerified;
    }

    public String getAvatar() {
// Path: app/src/main/java/org/houxg/leamonax/service/AccountService.java
// public class AccountService {
// 
//     public static Observable<BaseResponse> register(String email, String password) {
//         return RetrofitUtils.create(ApiProvider.getInstance().getAuthApi().register(email, password));
//     }
// 
//     public static Observable<Authentication> login(String email, String password) {
//         return RetrofitUtils.create(ApiProvider.getInstance().getAuthApi().login(email, password));
//     }
// 
//     public static Observable<User> getInfo(String userId) {
//         return RetrofitUtils.create(ApiProvider.getInstance().getUserApi().getInfo(userId));
//     }
// 
//     public static long saveToAccount(Authentication authentication, String host) {
//         Account localAccount = AppDataBase.getAccount(authentication.getEmail(), host);
//         if (localAccount == null) {
//             localAccount = new Account();
//         }
//         localAccount.setHost(host);
//         localAccount.setEmail(authentication.getEmail());
//         localAccount.setAccessToken(authentication.getAccessToken());
//         localAccount.setUserId(authentication.getUserId());
//         localAccount.setUserName(authentication.getUserName());
//         localAccount.save();
//         return localAccount.getLocalUserId();
//     }
// 
//     public static void saveToAccount(User user, String host) {
//         Account localAccount = AppDataBase.getAccount(user.getEmail(), host);
//         if (localAccount == null) {
//             localAccount = new Account();
//         }
//         localAccount.setHost(host);
//         localAccount.setEmail(user.getEmail());
//         localAccount.setUserId(user.getUserId());
//         localAccount.setUserName(user.getUserName());
//         localAccount.setAvatar(user.getAvatar());
//         localAccount.setVerified(user.isVerified());
//         localAccount.save();
//     }
// 
//     public static void logout() {
//         Account account = getCurrent();
//         account.setAccessToken("");
//         account.update();
//     }
// 
//     public static Observable<BaseResponse> changePassword(String oldPassword, String newPassword) {
//         return RetrofitUtils.create(ApiProvider.getInstance().getUserApi().updatePassword(oldPassword, newPassword));
//     }
// 
//     public static Observable<BaseResponse> changeUserName(String userName) {
//         return RetrofitUtils.create(ApiProvider.getInstance().getUserApi().updateUsername(userName));
//     }
// 
//     public static Account getCurrent() {
//         return AppDataBase.getAccountWithToken();
//     }
// 
//     public static List<Account> getAccountList() {
//         return AppDataBase.getAccountListWithToken();
//     }
// 
//     public static Account getAccountById(long id) {
//         return new Select()
//                 .from(Account.class)
//                 .where(Account_Table.id.eq(id))
//                 .querySingle();
//     }
// 
//     public static boolean isSignedIn() {
//         return getCurrent() != null;
//     }
// }


// Path: app/src/main/java/org/houxg/leamonax/model/User.java
import com.google.gson.annotations.SerializedName;
import com.raizlabs.android.dbflow.annotation.Column;
import org.houxg.leamonax.service.AccountService;

package org.houxg.leamonax.model;




public class User extends BaseResponse {

    @SerializedName("UserId")
    String userId = "";
    @SerializedName("Username")
    String userName = "";
    @Column(name = "email")
    @SerializedName("Email")
    String email = "";
    @SerializedName("Verified")
    boolean isVerified;
    @SerializedName("Logo")
    String avatar = "";

    public String getUserId() {
        return userId;
    }

    public String getUserName() {
        return userName;
    }

    public String getEmail() {
        return email;
    }

    public boolean isVerified() {
        return isVerified;
    }

    public String getAvatar() {
        Account current = AccountService.getCurrent();