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

import (
	"sync"

	"github.com/hyperledger/fabric-protos-go-apiv2/common"
	"github.com/hyperledger/fabric/orderer/consensus"
)

type Consenter struct {
	HandleChainStub        func(consensus.ConsenterSupport, *common.Metadata) (consensus.Chain, error)
	handleChainMutex       sync.RWMutex
	handleChainArgsForCall []struct {
		arg1 consensus.ConsenterSupport
		arg2 *common.Metadata
	}
	handleChainReturns struct {
		result1 consensus.Chain
		result2 error
	}
	handleChainReturnsOnCall map[int]struct {
		result1 consensus.Chain
		result2 error
	}
	IsChannelMemberStub        func(*common.Block) (bool, error)
	isChannelMemberMutex       sync.RWMutex
	isChannelMemberArgsForCall []struct {
		arg1 *common.Block
	}
	isChannelMemberReturns struct {
		result1 bool
		result2 error
	}
	isChannelMemberReturnsOnCall map[int]struct {
		result1 bool
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *Consenter) HandleChain(arg1 consensus.ConsenterSupport, arg2 *common.Metadata) (consensus.Chain, error) {
	fake.handleChainMutex.Lock()
	ret, specificReturn := fake.handleChainReturnsOnCall[len(fake.handleChainArgsForCall)]
	fake.handleChainArgsForCall = append(fake.handleChainArgsForCall, struct {
		arg1 consensus.ConsenterSupport
		arg2 *common.Metadata
	}{arg1, arg2})
	stub := fake.HandleChainStub
	fakeReturns := fake.handleChainReturns
	fake.recordInvocation("HandleChain", []interface{}{arg1, arg2})
	fake.handleChainMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *Consenter) HandleChainCallCount() int {
	fake.handleChainMutex.RLock()
	defer fake.handleChainMutex.RUnlock()
	return len(fake.handleChainArgsForCall)
}

func (fake *Consenter) HandleChainCalls(stub func(consensus.ConsenterSupport, *common.Metadata) (consensus.Chain, error)) {
	fake.handleChainMutex.Lock()
	defer fake.handleChainMutex.Unlock()
	fake.HandleChainStub = stub
}

func (fake *Consenter) HandleChainArgsForCall(i int) (consensus.ConsenterSupport, *common.Metadata) {
	fake.handleChainMutex.RLock()
	defer fake.handleChainMutex.RUnlock()
	argsForCall := fake.handleChainArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *Consenter) HandleChainReturns(result1 consensus.Chain, result2 error) {
	fake.handleChainMutex.Lock()
	defer fake.handleChainMutex.Unlock()
	fake.HandleChainStub = nil
	fake.handleChainReturns = struct {
		result1 consensus.Chain
		result2 error
	}{result1, result2}
}

func (fake *Consenter) HandleChainReturnsOnCall(i int, result1 consensus.Chain, result2 error) {
	fake.handleChainMutex.Lock()
	defer fake.handleChainMutex.Unlock()
	fake.HandleChainStub = nil
	if fake.handleChainReturnsOnCall == nil {
		fake.handleChainReturnsOnCall = make(map[int]struct {
			result1 consensus.Chain
			result2 error
		})
	}
	fake.handleChainReturnsOnCall[i] = struct {
		result1 consensus.Chain
		result2 error
	}{result1, result2}
}

func (fake *Consenter) IsChannelMember(arg1 *common.Block) (bool, error) {
	fake.isChannelMemberMutex.Lock()
	ret, specificReturn := fake.isChannelMemberReturnsOnCall[len(fake.isChannelMemberArgsForCall)]
	fake.isChannelMemberArgsForCall = append(fake.isChannelMemberArgsForCall, struct {
		arg1 *common.Block
	}{arg1})
	stub := fake.IsChannelMemberStub
	fakeReturns := fake.isChannelMemberReturns
	fake.recordInvocation("IsChannelMember", []interface{}{arg1})
	fake.isChannelMemberMutex.Unlock()
	if stub != nil {
		return stub(arg1)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *Consenter) IsChannelMemberCallCount() int {
	fake.isChannelMemberMutex.RLock()
	defer fake.isChannelMemberMutex.RUnlock()
	return len(fake.isChannelMemberArgsForCall)
}

func (fake *Consenter) IsChannelMemberCalls(stub func(*common.Block) (bool, error)) {
	fake.isChannelMemberMutex.Lock()
	defer fake.isChannelMemberMutex.Unlock()
	fake.IsChannelMemberStub = stub
}

func (fake *Consenter) IsChannelMemberArgsForCall(i int) *common.Block {
	fake.isChannelMemberMutex.RLock()
	defer fake.isChannelMemberMutex.RUnlock()
	argsForCall := fake.isChannelMemberArgsForCall[i]
	return argsForCall.arg1
}

func (fake *Consenter) IsChannelMemberReturns(result1 bool, result2 error) {
	fake.isChannelMemberMutex.Lock()
	defer fake.isChannelMemberMutex.Unlock()
	fake.IsChannelMemberStub = nil
	fake.isChannelMemberReturns = struct {
		result1 bool
		result2 error
	}{result1, result2}
}

func (fake *Consenter) IsChannelMemberReturnsOnCall(i int, result1 bool, result2 error) {
	fake.isChannelMemberMutex.Lock()
	defer fake.isChannelMemberMutex.Unlock()
	fake.IsChannelMemberStub = nil
	if fake.isChannelMemberReturnsOnCall == nil {
		fake.isChannelMemberReturnsOnCall = make(map[int]struct {
			result1 bool
			result2 error
		})
	}
	fake.isChannelMemberReturnsOnCall[i] = struct {
		result1 bool
		result2 error
	}{result1, result2}
}

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

func (fake *Consenter) 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)
}
