package eu.dnetlib.dlms.union.objects;

import eu.dnetlib.dlms.lowlevel.GeneralDAO;
import eu.dnetlib.dlms.lowlevel.objects.LLDigitalObject;
import eu.dnetlib.dlms.lowlevel.objects.Set;
import eu.dnetlib.dlms.lowlevel.objects.Wrapper;

/**
 * DAO interface for instances of class UnionSet.
 * 
 * @author lexis
 */
public interface UnionSetDAO extends GeneralDAO<UnionSet> {

	/**
	 * Inserts into unionSet a new Wrapper that wraps the given LLDigitalObject with the setTag provided.
	 * 
	 * @param unionSet
	 *            target set
	 * @param obj
	 *            the LLDigitalObject to add to the union
	 * @param setTag
	 *            the Set obj comes from
	 * @return the Wrapper added to unionSet
	 */
	Wrapper addToSet(UnionSet unionSet, LLDigitalObject obj, Set setTag);

	/**
	 * Inserts into unionSet a new Wrapper that wraps the given LLDigitalObject. This method suceeds only if obj belongs
	 * to only one Set, so that this Set can be used implicitly as setTag.
	 * 
	 * @param unionSet
	 *            the target set
	 * @param obj
	 *            LLDigitalObject to add
	 * @return the UnionObject added to unionSet
	 */
	Wrapper addToSet(UnionSet unionSet, LLDigitalObject obj);

	/**
	 * Adds unionObject to unionSet.
	 * 
	 * @param unionSet
	 *            target set
	 * @param unionObject
	 *            UnionObject to add
	 * @return unionObject added to unionSet
	 */
	Wrapper addToSet(UnionSet unionSet, Wrapper unionObject);

	/**
	 * Removes from unionSet the wrapper that has obj as objects and setTag as setTag.
	 * 
	 * @param unionSet
	 *            target set
	 * @param obj
	 *            LLDigitalObject to remove from the union
	 * @param setTag
	 *            the Set obj came from when added to the union set
	 */
	void removeFromSet(UnionSet unionSet, LLDigitalObject obj, Set setTag);

	/**
	 * Removes unionObject from unionSet.
	 * 
	 * @param unionSet
	 *            target set
	 * @param unionObject
	 *            Wrapper to remove
	 */
	void removeFromSet(UnionSet unionSet, Wrapper unionObject);

	/**
	 * Gets the UnionSet with the given name.
	 * 
	 * @param name
	 *            name of the UnionSet to return
	 * @return the UnionSet instance with the given name
	 */
	UnionSet getUnionSetByName(String name);
}
