package org.ntlab.radishforandroidstudio.cactusClient.models;

import static org.apache.commons.lang3.RandomStringUtils.random;

//あとで最新版に変える必要がある

public class Account {
    private String id,name, pass, token;
    private boolean login = false;

    public Account(String userName, String userPass) {
        setName(userName);
        setPass(userPass);
    }

    public String getId() {
        return id;
    }

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

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPass() {
        return pass;
    }

    public void setPass(String pass) {
        this.pass = pass;
    }

    public boolean isLogin() {
        return login;
    }

    public void setLogin(boolean login) {
        this.login = login;
    }

    public String getToken() {
        return token;
    }

    public String formToken() {
        token = random(64, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
        return token;
    }

    public Account getAccount(String token) {
        if (this.token == token) {
            return this;
        } else {
            return null;
        }
    }
}