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

import (
	"context"
	"sync"

	"code.cloudfoundry.org/korifi/api/repositories/k8sklient"
	"code.cloudfoundry.org/korifi/api/repositories/k8sklient/descriptors"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"sigs.k8s.io/controller-runtime/pkg/client"
)

type DescriptorClient struct {
	ListStub        func(context.Context, schema.GroupVersionKind, ...client.ListOption) (descriptors.ResultSetDescriptor, error)
	listMutex       sync.RWMutex
	listArgsForCall []struct {
		arg1 context.Context
		arg2 schema.GroupVersionKind
		arg3 []client.ListOption
	}
	listReturns struct {
		result1 descriptors.ResultSetDescriptor
		result2 error
	}
	listReturnsOnCall map[int]struct {
		result1 descriptors.ResultSetDescriptor
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *DescriptorClient) List(arg1 context.Context, arg2 schema.GroupVersionKind, arg3 ...client.ListOption) (descriptors.ResultSetDescriptor, error) {
	fake.listMutex.Lock()
	ret, specificReturn := fake.listReturnsOnCall[len(fake.listArgsForCall)]
	fake.listArgsForCall = append(fake.listArgsForCall, struct {
		arg1 context.Context
		arg2 schema.GroupVersionKind
		arg3 []client.ListOption
	}{arg1, arg2, arg3})
	stub := fake.ListStub
	fakeReturns := fake.listReturns
	fake.recordInvocation("List", []interface{}{arg1, arg2, arg3})
	fake.listMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2, arg3...)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *DescriptorClient) ListCallCount() int {
	fake.listMutex.RLock()
	defer fake.listMutex.RUnlock()
	return len(fake.listArgsForCall)
}

func (fake *DescriptorClient) ListCalls(stub func(context.Context, schema.GroupVersionKind, ...client.ListOption) (descriptors.ResultSetDescriptor, error)) {
	fake.listMutex.Lock()
	defer fake.listMutex.Unlock()
	fake.ListStub = stub
}

func (fake *DescriptorClient) ListArgsForCall(i int) (context.Context, schema.GroupVersionKind, []client.ListOption) {
	fake.listMutex.RLock()
	defer fake.listMutex.RUnlock()
	argsForCall := fake.listArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}

func (fake *DescriptorClient) ListReturns(result1 descriptors.ResultSetDescriptor, result2 error) {
	fake.listMutex.Lock()
	defer fake.listMutex.Unlock()
	fake.ListStub = nil
	fake.listReturns = struct {
		result1 descriptors.ResultSetDescriptor
		result2 error
	}{result1, result2}
}

func (fake *DescriptorClient) ListReturnsOnCall(i int, result1 descriptors.ResultSetDescriptor, result2 error) {
	fake.listMutex.Lock()
	defer fake.listMutex.Unlock()
	fake.ListStub = nil
	if fake.listReturnsOnCall == nil {
		fake.listReturnsOnCall = make(map[int]struct {
			result1 descriptors.ResultSetDescriptor
			result2 error
		})
	}
	fake.listReturnsOnCall[i] = struct {
		result1 descriptors.ResultSetDescriptor
		result2 error
	}{result1, result2}
}

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