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

import (
	"sync"

	"github.com/operator-framework/operator-registry/pkg/apprclient"
)

type FakeClient struct {
	ListPackagesStub        func(string) ([]*apprclient.RegistryMetadata, error)
	listPackagesMutex       sync.RWMutex
	listPackagesArgsForCall []struct {
		arg1 string
	}
	listPackagesReturns struct {
		result1 []*apprclient.RegistryMetadata
		result2 error
	}
	listPackagesReturnsOnCall map[int]struct {
		result1 []*apprclient.RegistryMetadata
		result2 error
	}
	RetrieveAllStub        func(string) ([]*apprclient.OperatorMetadata, error)
	retrieveAllMutex       sync.RWMutex
	retrieveAllArgsForCall []struct {
		arg1 string
	}
	retrieveAllReturns struct {
		result1 []*apprclient.OperatorMetadata
		result2 error
	}
	retrieveAllReturnsOnCall map[int]struct {
		result1 []*apprclient.OperatorMetadata
		result2 error
	}
	RetrieveOneStub        func(string, string) (*apprclient.OperatorMetadata, error)
	retrieveOneMutex       sync.RWMutex
	retrieveOneArgsForCall []struct {
		arg1 string
		arg2 string
	}
	retrieveOneReturns struct {
		result1 *apprclient.OperatorMetadata
		result2 error
	}
	retrieveOneReturnsOnCall map[int]struct {
		result1 *apprclient.OperatorMetadata
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeClient) ListPackages(arg1 string) ([]*apprclient.RegistryMetadata, error) {
	fake.listPackagesMutex.Lock()
	ret, specificReturn := fake.listPackagesReturnsOnCall[len(fake.listPackagesArgsForCall)]
	fake.listPackagesArgsForCall = append(fake.listPackagesArgsForCall, struct {
		arg1 string
	}{arg1})
	fake.recordInvocation("ListPackages", []interface{}{arg1})
	fake.listPackagesMutex.Unlock()
	if fake.ListPackagesStub != nil {
		return fake.ListPackagesStub(arg1)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	fakeReturns := fake.listPackagesReturns
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *FakeClient) ListPackagesCallCount() int {
	fake.listPackagesMutex.RLock()
	defer fake.listPackagesMutex.RUnlock()
	return len(fake.listPackagesArgsForCall)
}

func (fake *FakeClient) ListPackagesCalls(stub func(string) ([]*apprclient.RegistryMetadata, error)) {
	fake.listPackagesMutex.Lock()
	defer fake.listPackagesMutex.Unlock()
	fake.ListPackagesStub = stub
}

func (fake *FakeClient) ListPackagesArgsForCall(i int) string {
	fake.listPackagesMutex.RLock()
	defer fake.listPackagesMutex.RUnlock()
	argsForCall := fake.listPackagesArgsForCall[i]
	return argsForCall.arg1
}

func (fake *FakeClient) ListPackagesReturns(result1 []*apprclient.RegistryMetadata, result2 error) {
	fake.listPackagesMutex.Lock()
	defer fake.listPackagesMutex.Unlock()
	fake.ListPackagesStub = nil
	fake.listPackagesReturns = struct {
		result1 []*apprclient.RegistryMetadata
		result2 error
	}{result1, result2}
}

func (fake *FakeClient) ListPackagesReturnsOnCall(i int, result1 []*apprclient.RegistryMetadata, result2 error) {
	fake.listPackagesMutex.Lock()
	defer fake.listPackagesMutex.Unlock()
	fake.ListPackagesStub = nil
	if fake.listPackagesReturnsOnCall == nil {
		fake.listPackagesReturnsOnCall = make(map[int]struct {
			result1 []*apprclient.RegistryMetadata
			result2 error
		})
	}
	fake.listPackagesReturnsOnCall[i] = struct {
		result1 []*apprclient.RegistryMetadata
		result2 error
	}{result1, result2}
}

func (fake *FakeClient) RetrieveAll(arg1 string) ([]*apprclient.OperatorMetadata, error) {
	fake.retrieveAllMutex.Lock()
	ret, specificReturn := fake.retrieveAllReturnsOnCall[len(fake.retrieveAllArgsForCall)]
	fake.retrieveAllArgsForCall = append(fake.retrieveAllArgsForCall, struct {
		arg1 string
	}{arg1})
	fake.recordInvocation("RetrieveAll", []interface{}{arg1})
	fake.retrieveAllMutex.Unlock()
	if fake.RetrieveAllStub != nil {
		return fake.RetrieveAllStub(arg1)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	fakeReturns := fake.retrieveAllReturns
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *FakeClient) RetrieveAllCallCount() int {
	fake.retrieveAllMutex.RLock()
	defer fake.retrieveAllMutex.RUnlock()
	return len(fake.retrieveAllArgsForCall)
}

func (fake *FakeClient) RetrieveAllCalls(stub func(string) ([]*apprclient.OperatorMetadata, error)) {
	fake.retrieveAllMutex.Lock()
	defer fake.retrieveAllMutex.Unlock()
	fake.RetrieveAllStub = stub
}

func (fake *FakeClient) RetrieveAllArgsForCall(i int) string {
	fake.retrieveAllMutex.RLock()
	defer fake.retrieveAllMutex.RUnlock()
	argsForCall := fake.retrieveAllArgsForCall[i]
	return argsForCall.arg1
}

func (fake *FakeClient) RetrieveAllReturns(result1 []*apprclient.OperatorMetadata, result2 error) {
	fake.retrieveAllMutex.Lock()
	defer fake.retrieveAllMutex.Unlock()
	fake.RetrieveAllStub = nil
	fake.retrieveAllReturns = struct {
		result1 []*apprclient.OperatorMetadata
		result2 error
	}{result1, result2}
}

func (fake *FakeClient) RetrieveAllReturnsOnCall(i int, result1 []*apprclient.OperatorMetadata, result2 error) {
	fake.retrieveAllMutex.Lock()
	defer fake.retrieveAllMutex.Unlock()
	fake.RetrieveAllStub = nil
	if fake.retrieveAllReturnsOnCall == nil {
		fake.retrieveAllReturnsOnCall = make(map[int]struct {
			result1 []*apprclient.OperatorMetadata
			result2 error
		})
	}
	fake.retrieveAllReturnsOnCall[i] = struct {
		result1 []*apprclient.OperatorMetadata
		result2 error
	}{result1, result2}
}

func (fake *FakeClient) RetrieveOne(arg1 string, arg2 string) (*apprclient.OperatorMetadata, error) {
	fake.retrieveOneMutex.Lock()
	ret, specificReturn := fake.retrieveOneReturnsOnCall[len(fake.retrieveOneArgsForCall)]
	fake.retrieveOneArgsForCall = append(fake.retrieveOneArgsForCall, struct {
		arg1 string
		arg2 string
	}{arg1, arg2})
	fake.recordInvocation("RetrieveOne", []interface{}{arg1, arg2})
	fake.retrieveOneMutex.Unlock()
	if fake.RetrieveOneStub != nil {
		return fake.RetrieveOneStub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	fakeReturns := fake.retrieveOneReturns
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *FakeClient) RetrieveOneCallCount() int {
	fake.retrieveOneMutex.RLock()
	defer fake.retrieveOneMutex.RUnlock()
	return len(fake.retrieveOneArgsForCall)
}

func (fake *FakeClient) RetrieveOneCalls(stub func(string, string) (*apprclient.OperatorMetadata, error)) {
	fake.retrieveOneMutex.Lock()
	defer fake.retrieveOneMutex.Unlock()
	fake.RetrieveOneStub = stub
}

func (fake *FakeClient) RetrieveOneArgsForCall(i int) (string, string) {
	fake.retrieveOneMutex.RLock()
	defer fake.retrieveOneMutex.RUnlock()
	argsForCall := fake.retrieveOneArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *FakeClient) RetrieveOneReturns(result1 *apprclient.OperatorMetadata, result2 error) {
	fake.retrieveOneMutex.Lock()
	defer fake.retrieveOneMutex.Unlock()
	fake.RetrieveOneStub = nil
	fake.retrieveOneReturns = struct {
		result1 *apprclient.OperatorMetadata
		result2 error
	}{result1, result2}
}

func (fake *FakeClient) RetrieveOneReturnsOnCall(i int, result1 *apprclient.OperatorMetadata, result2 error) {
	fake.retrieveOneMutex.Lock()
	defer fake.retrieveOneMutex.Unlock()
	fake.RetrieveOneStub = nil
	if fake.retrieveOneReturnsOnCall == nil {
		fake.retrieveOneReturnsOnCall = make(map[int]struct {
			result1 *apprclient.OperatorMetadata
			result2 error
		})
	}
	fake.retrieveOneReturnsOnCall[i] = struct {
		result1 *apprclient.OperatorMetadata
		result2 error
	}{result1, result2}
}

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

func (fake *FakeClient) 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 _ apprclient.Client = new(FakeClient)
