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

import (
	sync "sync"

	lager "code.cloudfoundry.org/lager/v3"
	volman "code.cloudfoundry.org/volman"
)

type FakeDiscoverer struct {
	DiscoverStub        func(lager.Logger) (map[string]volman.Plugin, error)
	discoverMutex       sync.RWMutex
	discoverArgsForCall []struct {
		arg1 lager.Logger
	}
	discoverReturns struct {
		result1 map[string]volman.Plugin
		result2 error
	}
	discoverReturnsOnCall map[int]struct {
		result1 map[string]volman.Plugin
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeDiscoverer) Discover(arg1 lager.Logger) (map[string]volman.Plugin, error) {
	fake.discoverMutex.Lock()
	ret, specificReturn := fake.discoverReturnsOnCall[len(fake.discoverArgsForCall)]
	fake.discoverArgsForCall = append(fake.discoverArgsForCall, struct {
		arg1 lager.Logger
	}{arg1})
	fake.recordInvocation("Discover", []interface{}{arg1})
	fake.discoverMutex.Unlock()
	if fake.DiscoverStub != nil {
		return fake.DiscoverStub(arg1)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	fakeReturns := fake.discoverReturns
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *FakeDiscoverer) DiscoverCallCount() int {
	fake.discoverMutex.RLock()
	defer fake.discoverMutex.RUnlock()
	return len(fake.discoverArgsForCall)
}

func (fake *FakeDiscoverer) DiscoverCalls(stub func(lager.Logger) (map[string]volman.Plugin, error)) {
	fake.discoverMutex.Lock()
	defer fake.discoverMutex.Unlock()
	fake.DiscoverStub = stub
}

func (fake *FakeDiscoverer) DiscoverArgsForCall(i int) lager.Logger {
	fake.discoverMutex.RLock()
	defer fake.discoverMutex.RUnlock()
	argsForCall := fake.discoverArgsForCall[i]
	return argsForCall.arg1
}

func (fake *FakeDiscoverer) DiscoverReturns(result1 map[string]volman.Plugin, result2 error) {
	fake.discoverMutex.Lock()
	defer fake.discoverMutex.Unlock()
	fake.DiscoverStub = nil
	fake.discoverReturns = struct {
		result1 map[string]volman.Plugin
		result2 error
	}{result1, result2}
}

func (fake *FakeDiscoverer) DiscoverReturnsOnCall(i int, result1 map[string]volman.Plugin, result2 error) {
	fake.discoverMutex.Lock()
	defer fake.discoverMutex.Unlock()
	fake.DiscoverStub = nil
	if fake.discoverReturnsOnCall == nil {
		fake.discoverReturnsOnCall = make(map[int]struct {
			result1 map[string]volman.Plugin
			result2 error
		})
	}
	fake.discoverReturnsOnCall[i] = struct {
		result1 map[string]volman.Plugin
		result2 error
	}{result1, result2}
}

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

func (fake *FakeDiscoverer) 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 _ volman.Discoverer = new(FakeDiscoverer)
