// Code generated by counterfeiter. DO NOT EDIT.
package mocks

import (
	"sync"

	"github.com/hyperledger/fabric-lib-go/bccsp"
	"github.com/hyperledger/fabric/orderer/common/cluster"
	"github.com/hyperledger/fabric/orderer/common/localconfig"
	"github.com/hyperledger/fabric/orderer/consensus"
	"github.com/hyperledger/fabric/orderer/consensus/smartbft"
)

type FakeBlockPullerFactory struct {
	CreateBlockPullerStub        func(consensus.ConsenterSupport, *cluster.PredicateDialer, localconfig.Cluster, bccsp.BCCSP) (smartbft.BlockPuller, error)
	createBlockPullerMutex       sync.RWMutex
	createBlockPullerArgsForCall []struct {
		arg1 consensus.ConsenterSupport
		arg2 *cluster.PredicateDialer
		arg3 localconfig.Cluster
		arg4 bccsp.BCCSP
	}
	createBlockPullerReturns struct {
		result1 smartbft.BlockPuller
		result2 error
	}
	createBlockPullerReturnsOnCall map[int]struct {
		result1 smartbft.BlockPuller
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeBlockPullerFactory) CreateBlockPuller(arg1 consensus.ConsenterSupport, arg2 *cluster.PredicateDialer, arg3 localconfig.Cluster, arg4 bccsp.BCCSP) (smartbft.BlockPuller, error) {
	fake.createBlockPullerMutex.Lock()
	ret, specificReturn := fake.createBlockPullerReturnsOnCall[len(fake.createBlockPullerArgsForCall)]
	fake.createBlockPullerArgsForCall = append(fake.createBlockPullerArgsForCall, struct {
		arg1 consensus.ConsenterSupport
		arg2 *cluster.PredicateDialer
		arg3 localconfig.Cluster
		arg4 bccsp.BCCSP
	}{arg1, arg2, arg3, arg4})
	stub := fake.CreateBlockPullerStub
	fakeReturns := fake.createBlockPullerReturns
	fake.recordInvocation("CreateBlockPuller", []interface{}{arg1, arg2, arg3, arg4})
	fake.createBlockPullerMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2, arg3, arg4)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *FakeBlockPullerFactory) CreateBlockPullerCallCount() int {
	fake.createBlockPullerMutex.RLock()
	defer fake.createBlockPullerMutex.RUnlock()
	return len(fake.createBlockPullerArgsForCall)
}

func (fake *FakeBlockPullerFactory) CreateBlockPullerCalls(stub func(consensus.ConsenterSupport, *cluster.PredicateDialer, localconfig.Cluster, bccsp.BCCSP) (smartbft.BlockPuller, error)) {
	fake.createBlockPullerMutex.Lock()
	defer fake.createBlockPullerMutex.Unlock()
	fake.CreateBlockPullerStub = stub
}

func (fake *FakeBlockPullerFactory) CreateBlockPullerArgsForCall(i int) (consensus.ConsenterSupport, *cluster.PredicateDialer, localconfig.Cluster, bccsp.BCCSP) {
	fake.createBlockPullerMutex.RLock()
	defer fake.createBlockPullerMutex.RUnlock()
	argsForCall := fake.createBlockPullerArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
}

func (fake *FakeBlockPullerFactory) CreateBlockPullerReturns(result1 smartbft.BlockPuller, result2 error) {
	fake.createBlockPullerMutex.Lock()
	defer fake.createBlockPullerMutex.Unlock()
	fake.CreateBlockPullerStub = nil
	fake.createBlockPullerReturns = struct {
		result1 smartbft.BlockPuller
		result2 error
	}{result1, result2}
}

func (fake *FakeBlockPullerFactory) CreateBlockPullerReturnsOnCall(i int, result1 smartbft.BlockPuller, result2 error) {
	fake.createBlockPullerMutex.Lock()
	defer fake.createBlockPullerMutex.Unlock()
	fake.CreateBlockPullerStub = nil
	if fake.createBlockPullerReturnsOnCall == nil {
		fake.createBlockPullerReturnsOnCall = make(map[int]struct {
			result1 smartbft.BlockPuller
			result2 error
		})
	}
	fake.createBlockPullerReturnsOnCall[i] = struct {
		result1 smartbft.BlockPuller
		result2 error
	}{result1, result2}
}

func (fake *FakeBlockPullerFactory) Invocations() map[string][][]interface{} {
	fake.invocationsMutex.RLock()
	defer fake.invocationsMutex.RUnlock()
	fake.createBlockPullerMutex.RLock()
	defer fake.createBlockPullerMutex.RUnlock()
	copiedInvocations := map[string][][]interface{}{}
	for key, value := range fake.invocations {
		copiedInvocations[key] = value
	}
	return copiedInvocations
}

func (fake *FakeBlockPullerFactory) recordInvocation(key string, args []interface{}) {
	fake.invocationsMutex.Lock()
	defer fake.invocationsMutex.Unlock()
	if fake.invocations == nil {
		fake.invocations = map[string][][]interface{}{}
	}
	if fake.invocations[key] == nil {
		fake.invocations[key] = [][]interface{}{}
	}
	fake.invocations[key] = append(fake.invocations[key], args)
}

var _ smartbft.BlockPullerFactory = new(FakeBlockPullerFactory)
