package org.allmyinfo.nature.basic;

import org.allmyinfo.nature.Nature;
import org.allmyinfo.nodes.NodeId;
import org.allmyinfo.nodes.NodeIdType;
import org.allmyinfo.nodes.database.NodesTransaction;
import org.allmyinfo.util.osgi.reactor.BaseReactor;
import org.eclipse.jdt.annotation.NonNull;
import org.osgi.framework.BundleContext;

public interface Int4Nature extends Nature {
	@NonNull
	Integer getValue(@NonNull NodesTransaction txn, @NonNull NodeId nodeId);

	@NonNull
	NodeId insertNode(@NonNull NodesTransaction txn, @NonNull Integer value);

	@NonNull
	NodeId insertNode(@NonNull NodesTransaction txn, @NonNull Integer value,
			@NonNull NodeIdType nodeIdType);

	public static class Reactor extends BaseReactor {
		@SuppressWarnings("null")
		public Reactor(final @NonNull BundleContext bundleContext,
				final @NonNull Int4Nature defaultInstance) {
			super(bundleContext, Int4Nature.class.getName(), null, defaultInstance);
		}

		@Override
		public @NonNull Int4Nature getInstance() {
			return (Int4Nature) super.getInstance();
		}
	}
}
