package geniusweb.profileconnection;

import java.io.IOException;

import org.eclipse.jdt.annotation.NonNull;

import geniusweb.profile.Profile;
import tudelft.utilities.listener.Listenable;

/**
 * A container holding a modifyable profile. This interface allows testing.
 */
public interface ProfileInterface extends Listenable<Profile> {

	/**
	 * @return the latest version of the profile. May change at any time, after
	 *         someone updates the version on the server. Call to this may block
	 *         for limited time if the profile is not yet available.
	 * @throws IOException if profile can not be fetched
	 */
	public @NonNull Profile getProfile() throws IOException;

	/**
	 * This must be called when the user is finished using the interface. The
	 * interface can not be used after calling this. This function allows
	 * implementors to release the streams and listeners. Not calling this after
	 * use may cause resource leaks.
	 */
	public void close();
}
