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

import (
	"sync"

	"github.com/hyperledger/fabric-lib-go/bccsp"
	"github.com/hyperledger/fabric-lib-go/common/flogging"
	"github.com/hyperledger/fabric-protos-go-apiv2/common"
	"github.com/hyperledger/fabric/common/deliverclient"
	"github.com/hyperledger/fabric/orderer/consensus/smartbft"
)

type VerifierFactory struct {
	CreateBlockVerifierStub        func(*common.Block, *common.Block, bccsp.BCCSP, *flogging.FabricLogger) (deliverclient.CloneableUpdatableBlockVerifier, error)
	createBlockVerifierMutex       sync.RWMutex
	createBlockVerifierArgsForCall []struct {
		arg1 *common.Block
		arg2 *common.Block
		arg3 bccsp.BCCSP
		arg4 *flogging.FabricLogger
	}
	createBlockVerifierReturns struct {
		result1 deliverclient.CloneableUpdatableBlockVerifier
		result2 error
	}
	createBlockVerifierReturnsOnCall map[int]struct {
		result1 deliverclient.CloneableUpdatableBlockVerifier
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *VerifierFactory) CreateBlockVerifier(arg1 *common.Block, arg2 *common.Block, arg3 bccsp.BCCSP, arg4 *flogging.FabricLogger) (deliverclient.CloneableUpdatableBlockVerifier, error) {
	fake.createBlockVerifierMutex.Lock()
	ret, specificReturn := fake.createBlockVerifierReturnsOnCall[len(fake.createBlockVerifierArgsForCall)]
	fake.createBlockVerifierArgsForCall = append(fake.createBlockVerifierArgsForCall, struct {
		arg1 *common.Block
		arg2 *common.Block
		arg3 bccsp.BCCSP
		arg4 *flogging.FabricLogger
	}{arg1, arg2, arg3, arg4})
	stub := fake.CreateBlockVerifierStub
	fakeReturns := fake.createBlockVerifierReturns
	fake.recordInvocation("CreateBlockVerifier", []interface{}{arg1, arg2, arg3, arg4})
	fake.createBlockVerifierMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2, arg3, arg4)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *VerifierFactory) CreateBlockVerifierCallCount() int {
	fake.createBlockVerifierMutex.RLock()
	defer fake.createBlockVerifierMutex.RUnlock()
	return len(fake.createBlockVerifierArgsForCall)
}

func (fake *VerifierFactory) CreateBlockVerifierCalls(stub func(*common.Block, *common.Block, bccsp.BCCSP, *flogging.FabricLogger) (deliverclient.CloneableUpdatableBlockVerifier, error)) {
	fake.createBlockVerifierMutex.Lock()
	defer fake.createBlockVerifierMutex.Unlock()
	fake.CreateBlockVerifierStub = stub
}

func (fake *VerifierFactory) CreateBlockVerifierArgsForCall(i int) (*common.Block, *common.Block, bccsp.BCCSP, *flogging.FabricLogger) {
	fake.createBlockVerifierMutex.RLock()
	defer fake.createBlockVerifierMutex.RUnlock()
	argsForCall := fake.createBlockVerifierArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
}

func (fake *VerifierFactory) CreateBlockVerifierReturns(result1 deliverclient.CloneableUpdatableBlockVerifier, result2 error) {
	fake.createBlockVerifierMutex.Lock()
	defer fake.createBlockVerifierMutex.Unlock()
	fake.CreateBlockVerifierStub = nil
	fake.createBlockVerifierReturns = struct {
		result1 deliverclient.CloneableUpdatableBlockVerifier
		result2 error
	}{result1, result2}
}

func (fake *VerifierFactory) CreateBlockVerifierReturnsOnCall(i int, result1 deliverclient.CloneableUpdatableBlockVerifier, result2 error) {
	fake.createBlockVerifierMutex.Lock()
	defer fake.createBlockVerifierMutex.Unlock()
	fake.CreateBlockVerifierStub = nil
	if fake.createBlockVerifierReturnsOnCall == nil {
		fake.createBlockVerifierReturnsOnCall = make(map[int]struct {
			result1 deliverclient.CloneableUpdatableBlockVerifier
			result2 error
		})
	}
	fake.createBlockVerifierReturnsOnCall[i] = struct {
		result1 deliverclient.CloneableUpdatableBlockVerifier
		result2 error
	}{result1, result2}
}

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

func (fake *VerifierFactory) 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.VerifierFactory = new(VerifierFactory)
