package org.allmyinfo.nature.impl.assignment.linkHandler;

import java.util.HashSet;
import java.util.Set;

import org.allmyinfo.nature.assignment.linkHandler.LinkHandlerAssignmentObjectMeaning;
import org.allmyinfo.nodes.NodeId;
import org.allmyinfo.nodes.database.NodesTransaction;
import org.eclipse.jdt.annotation.NonNull;

public class LinkHandlerAssignmentObjectMeaningImpl implements LinkHandlerAssignmentObjectMeaning {
	public static final @NonNull String NAME = "org.allmyinfo.assignment.linkHandler.object";
	private final @NonNull NodeId nodeId;
	private final @NonNull LinkHandlerAssignmentNatureImpl mySourceNature;

	public LinkHandlerAssignmentObjectMeaningImpl(final @NonNull NodeId nodeId,
			final @NonNull LinkHandlerAssignmentNatureImpl mySourceNature) {
		this.nodeId = nodeId;
		this.mySourceNature = mySourceNature;
	}

	@Override
	public @NonNull NodeId getNodeId() {
		return nodeId;
	}

	@Override
	public @NonNull Set<NodeId> getRequiredTargetNatures() {
		return new HashSet<>(0);
	}

	@Override
	public @NonNull Set<NodeId> getRequiredSourceNatures() {
		final Set<NodeId> set = new HashSet<>(1);
		set.add(mySourceNature.getNodeId());
		return set;
	}

	@Override
	public boolean inverted() {
		return true;
	}

	@Override
	public void onCreate(final @NonNull NodesTransaction txn, final @NonNull NodeId sourceNodeId,
			final @NonNull NodeId targetNodeId) {
	}

	@Override
	public void onDelete(final @NonNull NodesTransaction txn, final @NonNull NodeId sourceNodeId,
			final @NonNull NodeId targetNodeId) {
	}
}
