package core.user;

import core.process.Condition;
import core.user.userFun.AccountManageable;
import core.user.userFun.ProcessConfigurable;

import java.util.List;

public abstract class User implements AccountManageable, ProcessConfigurable{

    private String id;
    private String password;
    private List<String> permissions = null;
    private Condition condition;
    public void addPermission(String permission){
        if(!permissions.contains(permission))
            permissions.add(permission);
    }
    public void removePermission(String permission){
        permissions.remove(permission);
    }
    public boolean checkPermission(String permission){
        return permissions.contains(permission);

    }
    public User(){
        super();

    }
    public String getType(){
        return this.getClass().getName();
    }

    public void destroy(){
        core.user.utils.AccountManagement.destroy(this);
    }

    public void logout(){
        core.user.utils.AccountManagement.logout(this);
    }

    @Override
    public void syncToDatabase() {

    }

    @Override
    public void syncFromDatabase() {

    }
}
