package org.lumongo.client.command;

import com.google.protobuf.RpcController;
import com.google.protobuf.ServiceException;
import org.lumongo.client.command.base.SimpleCommand;
import org.lumongo.client.pool.LumongoConnection;
import org.lumongo.client.result.GetNumberOfDocsResult;
import org.lumongo.cluster.message.Lumongo.ExternalService;
import org.lumongo.cluster.message.Lumongo.GetNumberOfDocsRequest;
import org.lumongo.cluster.message.Lumongo.GetNumberOfDocsResponse;

public class GetNumberOfDocs extends SimpleCommand<GetNumberOfDocsRequest, GetNumberOfDocsResult> {

	private String indexName;
	private Boolean realTime;

	public GetNumberOfDocs(String indexName) {
		this.indexName = indexName;
	}

	public Boolean getRealTime() {
		return realTime;
	}

	public GetNumberOfDocs setRealTime(Boolean realTime) {
		this.realTime = realTime;
		return this;
	}

	@Override
	public GetNumberOfDocsRequest getRequest() {
		return GetNumberOfDocsRequest.newBuilder().setIndexName(indexName).build();
	}

	@Override
	public GetNumberOfDocsResult execute(LumongoConnection lumongoConnection) throws ServiceException {
		ExternalService.BlockingInterface service = lumongoConnection.getService();

		RpcController controller = lumongoConnection.getController();

		GetNumberOfDocsResponse getNumberOfDocsResponse = service.getNumberOfDocs(controller, getRequest());

		return new GetNumberOfDocsResult(getNumberOfDocsResponse);
	}

}

@@ -604,35 +604,8 @@
 ame;
-%0A%09private Boolean realTime;
 %0A%0A%09p
@@ -684,166 +684,8 @@
 %09%7D%0A%0A
-%09public Boolean getRealTime() %7B%0A%09%09return realTime;%0A%09%7D%0A%0A%09public GetNumberOfDocs setRealTime(Boolean realTime) %7B%0A%09%09this.realTime = realTime;%0A%09%09return this;%0A%09%7D%0A%0A
 %09@Ov

remove realtime count which no longer exists