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

import (
	"sync"

	"code.cloudfoundry.org/korifi/api/authorization"
	"sigs.k8s.io/controller-runtime/pkg/client"
)

type UserClientFactory struct {
	BuildClientStub        func(authorization.Info) (client.WithWatch, error)
	buildClientMutex       sync.RWMutex
	buildClientArgsForCall []struct {
		arg1 authorization.Info
	}
	buildClientReturns struct {
		result1 client.WithWatch
		result2 error
	}
	buildClientReturnsOnCall map[int]struct {
		result1 client.WithWatch
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *UserClientFactory) BuildClient(arg1 authorization.Info) (client.WithWatch, error) {
	fake.buildClientMutex.Lock()
	ret, specificReturn := fake.buildClientReturnsOnCall[len(fake.buildClientArgsForCall)]
	fake.buildClientArgsForCall = append(fake.buildClientArgsForCall, struct {
		arg1 authorization.Info
	}{arg1})
	stub := fake.BuildClientStub
	fakeReturns := fake.buildClientReturns
	fake.recordInvocation("BuildClient", []interface{}{arg1})
	fake.buildClientMutex.Unlock()
	if stub != nil {
		return stub(arg1)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *UserClientFactory) BuildClientCallCount() int {
	fake.buildClientMutex.RLock()
	defer fake.buildClientMutex.RUnlock()
	return len(fake.buildClientArgsForCall)
}

func (fake *UserClientFactory) BuildClientCalls(stub func(authorization.Info) (client.WithWatch, error)) {
	fake.buildClientMutex.Lock()
	defer fake.buildClientMutex.Unlock()
	fake.BuildClientStub = stub
}

func (fake *UserClientFactory) BuildClientArgsForCall(i int) authorization.Info {
	fake.buildClientMutex.RLock()
	defer fake.buildClientMutex.RUnlock()
	argsForCall := fake.buildClientArgsForCall[i]
	return argsForCall.arg1
}

func (fake *UserClientFactory) BuildClientReturns(result1 client.WithWatch, result2 error) {
	fake.buildClientMutex.Lock()
	defer fake.buildClientMutex.Unlock()
	fake.BuildClientStub = nil
	fake.buildClientReturns = struct {
		result1 client.WithWatch
		result2 error
	}{result1, result2}
}

func (fake *UserClientFactory) BuildClientReturnsOnCall(i int, result1 client.WithWatch, result2 error) {
	fake.buildClientMutex.Lock()
	defer fake.buildClientMutex.Unlock()
	fake.BuildClientStub = nil
	if fake.buildClientReturnsOnCall == nil {
		fake.buildClientReturnsOnCall = make(map[int]struct {
			result1 client.WithWatch
			result2 error
		})
	}
	fake.buildClientReturnsOnCall[i] = struct {
		result1 client.WithWatch
		result2 error
	}{result1, result2}
}

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

func (fake *UserClientFactory) 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 _ authorization.UserClientFactory = new(UserClientFactory)
