package eu.eudat.logic.security.customproviders.ConfigurableProvider;

import eu.eudat.logic.security.customproviders.ConfigurableProvider.entities.oauth2.Oauth2ConfigurableProviderUserSettings;

import java.util.Map;

public class ConfigurableProviderUser {
	private String id;
	private String name;
	private String email;

	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 getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}

	ConfigurableProviderUser getConfigurableProviderUser(Map data, Oauth2ConfigurableProviderUserSettings user) {
		if (user.getId() != null && !user.getId().isEmpty())
			this.id = (String) data.get(user.getId());
		if (user.getName() != null && !user.getName().isEmpty())
			this.name = (String) data.get(user.getName());
		if (user.getEmail() != null && !user.getEmail().isEmpty())
			this.email = (String) data.get(user.getEmail());
		return this;
	}
}
