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

import (
	"sync"

	"code.cloudfoundry.org/route-emitter/emitter"
	"code.cloudfoundry.org/route-emitter/routingtable"
)

type FakeNATSEmitter struct {
	EmitStub        func(routingtable.MessagesToEmit) error
	emitMutex       sync.RWMutex
	emitArgsForCall []struct {
		arg1 routingtable.MessagesToEmit
	}
	emitReturns struct {
		result1 error
	}
	emitReturnsOnCall map[int]struct {
		result1 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeNATSEmitter) Emit(arg1 routingtable.MessagesToEmit) error {
	fake.emitMutex.Lock()
	ret, specificReturn := fake.emitReturnsOnCall[len(fake.emitArgsForCall)]
	fake.emitArgsForCall = append(fake.emitArgsForCall, struct {
		arg1 routingtable.MessagesToEmit
	}{arg1})
	fake.recordInvocation("Emit", []interface{}{arg1})
	fake.emitMutex.Unlock()
	if fake.EmitStub != nil {
		return fake.EmitStub(arg1)
	}
	if specificReturn {
		return ret.result1
	}
	fakeReturns := fake.emitReturns
	return fakeReturns.result1
}

func (fake *FakeNATSEmitter) EmitCallCount() int {
	fake.emitMutex.RLock()
	defer fake.emitMutex.RUnlock()
	return len(fake.emitArgsForCall)
}

func (fake *FakeNATSEmitter) EmitCalls(stub func(routingtable.MessagesToEmit) error) {
	fake.emitMutex.Lock()
	defer fake.emitMutex.Unlock()
	fake.EmitStub = stub
}

func (fake *FakeNATSEmitter) EmitArgsForCall(i int) routingtable.MessagesToEmit {
	fake.emitMutex.RLock()
	defer fake.emitMutex.RUnlock()
	argsForCall := fake.emitArgsForCall[i]
	return argsForCall.arg1
}

func (fake *FakeNATSEmitter) EmitReturns(result1 error) {
	fake.emitMutex.Lock()
	defer fake.emitMutex.Unlock()
	fake.EmitStub = nil
	fake.emitReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeNATSEmitter) EmitReturnsOnCall(i int, result1 error) {
	fake.emitMutex.Lock()
	defer fake.emitMutex.Unlock()
	fake.EmitStub = nil
	if fake.emitReturnsOnCall == nil {
		fake.emitReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.emitReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

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

func (fake *FakeNATSEmitter) 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 _ emitter.NATSEmitter = new(FakeNATSEmitter)
