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

import (
	"sync"

	"github.com/operator-framework/operator-registry/pkg/lib/indexer"
)

type FakeIndexAdder struct {
	AddToIndexStub        func(indexer.AddToIndexRequest) error
	addToIndexMutex       sync.RWMutex
	addToIndexArgsForCall []struct {
		arg1 indexer.AddToIndexRequest
	}
	addToIndexReturns struct {
		result1 error
	}
	addToIndexReturnsOnCall map[int]struct {
		result1 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeIndexAdder) AddToIndex(arg1 indexer.AddToIndexRequest) error {
	fake.addToIndexMutex.Lock()
	ret, specificReturn := fake.addToIndexReturnsOnCall[len(fake.addToIndexArgsForCall)]
	fake.addToIndexArgsForCall = append(fake.addToIndexArgsForCall, struct {
		arg1 indexer.AddToIndexRequest
	}{arg1})
	fake.recordInvocation("AddToIndex", []interface{}{arg1})
	fake.addToIndexMutex.Unlock()
	if fake.AddToIndexStub != nil {
		return fake.AddToIndexStub(arg1)
	}
	if specificReturn {
		return ret.result1
	}
	fakeReturns := fake.addToIndexReturns
	return fakeReturns.result1
}

func (fake *FakeIndexAdder) AddToIndexCallCount() int {
	fake.addToIndexMutex.RLock()
	defer fake.addToIndexMutex.RUnlock()
	return len(fake.addToIndexArgsForCall)
}

func (fake *FakeIndexAdder) AddToIndexCalls(stub func(indexer.AddToIndexRequest) error) {
	fake.addToIndexMutex.Lock()
	defer fake.addToIndexMutex.Unlock()
	fake.AddToIndexStub = stub
}

func (fake *FakeIndexAdder) AddToIndexArgsForCall(i int) indexer.AddToIndexRequest {
	fake.addToIndexMutex.RLock()
	defer fake.addToIndexMutex.RUnlock()
	argsForCall := fake.addToIndexArgsForCall[i]
	return argsForCall.arg1
}

func (fake *FakeIndexAdder) AddToIndexReturns(result1 error) {
	fake.addToIndexMutex.Lock()
	defer fake.addToIndexMutex.Unlock()
	fake.AddToIndexStub = nil
	fake.addToIndexReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeIndexAdder) AddToIndexReturnsOnCall(i int, result1 error) {
	fake.addToIndexMutex.Lock()
	defer fake.addToIndexMutex.Unlock()
	fake.AddToIndexStub = nil
	if fake.addToIndexReturnsOnCall == nil {
		fake.addToIndexReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.addToIndexReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

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

func (fake *FakeIndexAdder) 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 _ indexer.IndexAdder = new(FakeIndexAdder)
