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

import (
	"context"
	"sync"

	"code.cloudfoundry.org/korifi/api/authorization"
	"code.cloudfoundry.org/korifi/api/handlers"
	"code.cloudfoundry.org/korifi/api/repositories"
)

type CFPackageRepository struct {
	CreatePackageStub        func(context.Context, authorization.Info, repositories.CreatePackageMessage) (repositories.PackageRecord, error)
	createPackageMutex       sync.RWMutex
	createPackageArgsForCall []struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 repositories.CreatePackageMessage
	}
	createPackageReturns struct {
		result1 repositories.PackageRecord
		result2 error
	}
	createPackageReturnsOnCall map[int]struct {
		result1 repositories.PackageRecord
		result2 error
	}
	GetPackageStub        func(context.Context, authorization.Info, string) (repositories.PackageRecord, error)
	getPackageMutex       sync.RWMutex
	getPackageArgsForCall []struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 string
	}
	getPackageReturns struct {
		result1 repositories.PackageRecord
		result2 error
	}
	getPackageReturnsOnCall map[int]struct {
		result1 repositories.PackageRecord
		result2 error
	}
	ListPackagesStub        func(context.Context, authorization.Info, repositories.ListPackagesMessage) (repositories.ListResult[repositories.PackageRecord], error)
	listPackagesMutex       sync.RWMutex
	listPackagesArgsForCall []struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 repositories.ListPackagesMessage
	}
	listPackagesReturns struct {
		result1 repositories.ListResult[repositories.PackageRecord]
		result2 error
	}
	listPackagesReturnsOnCall map[int]struct {
		result1 repositories.ListResult[repositories.PackageRecord]
		result2 error
	}
	UpdatePackageStub        func(context.Context, authorization.Info, repositories.UpdatePackageMessage) (repositories.PackageRecord, error)
	updatePackageMutex       sync.RWMutex
	updatePackageArgsForCall []struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 repositories.UpdatePackageMessage
	}
	updatePackageReturns struct {
		result1 repositories.PackageRecord
		result2 error
	}
	updatePackageReturnsOnCall map[int]struct {
		result1 repositories.PackageRecord
		result2 error
	}
	UpdatePackageSourceStub        func(context.Context, authorization.Info, repositories.UpdatePackageSourceMessage) (repositories.PackageRecord, error)
	updatePackageSourceMutex       sync.RWMutex
	updatePackageSourceArgsForCall []struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 repositories.UpdatePackageSourceMessage
	}
	updatePackageSourceReturns struct {
		result1 repositories.PackageRecord
		result2 error
	}
	updatePackageSourceReturnsOnCall map[int]struct {
		result1 repositories.PackageRecord
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *CFPackageRepository) CreatePackage(arg1 context.Context, arg2 authorization.Info, arg3 repositories.CreatePackageMessage) (repositories.PackageRecord, error) {
	fake.createPackageMutex.Lock()
	ret, specificReturn := fake.createPackageReturnsOnCall[len(fake.createPackageArgsForCall)]
	fake.createPackageArgsForCall = append(fake.createPackageArgsForCall, struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 repositories.CreatePackageMessage
	}{arg1, arg2, arg3})
	stub := fake.CreatePackageStub
	fakeReturns := fake.createPackageReturns
	fake.recordInvocation("CreatePackage", []interface{}{arg1, arg2, arg3})
	fake.createPackageMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2, arg3)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *CFPackageRepository) CreatePackageCallCount() int {
	fake.createPackageMutex.RLock()
	defer fake.createPackageMutex.RUnlock()
	return len(fake.createPackageArgsForCall)
}

func (fake *CFPackageRepository) CreatePackageCalls(stub func(context.Context, authorization.Info, repositories.CreatePackageMessage) (repositories.PackageRecord, error)) {
	fake.createPackageMutex.Lock()
	defer fake.createPackageMutex.Unlock()
	fake.CreatePackageStub = stub
}

func (fake *CFPackageRepository) CreatePackageArgsForCall(i int) (context.Context, authorization.Info, repositories.CreatePackageMessage) {
	fake.createPackageMutex.RLock()
	defer fake.createPackageMutex.RUnlock()
	argsForCall := fake.createPackageArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}

func (fake *CFPackageRepository) CreatePackageReturns(result1 repositories.PackageRecord, result2 error) {
	fake.createPackageMutex.Lock()
	defer fake.createPackageMutex.Unlock()
	fake.CreatePackageStub = nil
	fake.createPackageReturns = struct {
		result1 repositories.PackageRecord
		result2 error
	}{result1, result2}
}

func (fake *CFPackageRepository) CreatePackageReturnsOnCall(i int, result1 repositories.PackageRecord, result2 error) {
	fake.createPackageMutex.Lock()
	defer fake.createPackageMutex.Unlock()
	fake.CreatePackageStub = nil
	if fake.createPackageReturnsOnCall == nil {
		fake.createPackageReturnsOnCall = make(map[int]struct {
			result1 repositories.PackageRecord
			result2 error
		})
	}
	fake.createPackageReturnsOnCall[i] = struct {
		result1 repositories.PackageRecord
		result2 error
	}{result1, result2}
}

func (fake *CFPackageRepository) GetPackage(arg1 context.Context, arg2 authorization.Info, arg3 string) (repositories.PackageRecord, error) {
	fake.getPackageMutex.Lock()
	ret, specificReturn := fake.getPackageReturnsOnCall[len(fake.getPackageArgsForCall)]
	fake.getPackageArgsForCall = append(fake.getPackageArgsForCall, struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 string
	}{arg1, arg2, arg3})
	stub := fake.GetPackageStub
	fakeReturns := fake.getPackageReturns
	fake.recordInvocation("GetPackage", []interface{}{arg1, arg2, arg3})
	fake.getPackageMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2, arg3)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *CFPackageRepository) GetPackageCallCount() int {
	fake.getPackageMutex.RLock()
	defer fake.getPackageMutex.RUnlock()
	return len(fake.getPackageArgsForCall)
}

func (fake *CFPackageRepository) GetPackageCalls(stub func(context.Context, authorization.Info, string) (repositories.PackageRecord, error)) {
	fake.getPackageMutex.Lock()
	defer fake.getPackageMutex.Unlock()
	fake.GetPackageStub = stub
}

func (fake *CFPackageRepository) GetPackageArgsForCall(i int) (context.Context, authorization.Info, string) {
	fake.getPackageMutex.RLock()
	defer fake.getPackageMutex.RUnlock()
	argsForCall := fake.getPackageArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}

func (fake *CFPackageRepository) GetPackageReturns(result1 repositories.PackageRecord, result2 error) {
	fake.getPackageMutex.Lock()
	defer fake.getPackageMutex.Unlock()
	fake.GetPackageStub = nil
	fake.getPackageReturns = struct {
		result1 repositories.PackageRecord
		result2 error
	}{result1, result2}
}

func (fake *CFPackageRepository) GetPackageReturnsOnCall(i int, result1 repositories.PackageRecord, result2 error) {
	fake.getPackageMutex.Lock()
	defer fake.getPackageMutex.Unlock()
	fake.GetPackageStub = nil
	if fake.getPackageReturnsOnCall == nil {
		fake.getPackageReturnsOnCall = make(map[int]struct {
			result1 repositories.PackageRecord
			result2 error
		})
	}
	fake.getPackageReturnsOnCall[i] = struct {
		result1 repositories.PackageRecord
		result2 error
	}{result1, result2}
}

func (fake *CFPackageRepository) ListPackages(arg1 context.Context, arg2 authorization.Info, arg3 repositories.ListPackagesMessage) (repositories.ListResult[repositories.PackageRecord], error) {
	fake.listPackagesMutex.Lock()
	ret, specificReturn := fake.listPackagesReturnsOnCall[len(fake.listPackagesArgsForCall)]
	fake.listPackagesArgsForCall = append(fake.listPackagesArgsForCall, struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 repositories.ListPackagesMessage
	}{arg1, arg2, arg3})
	stub := fake.ListPackagesStub
	fakeReturns := fake.listPackagesReturns
	fake.recordInvocation("ListPackages", []interface{}{arg1, arg2, arg3})
	fake.listPackagesMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2, arg3)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

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

func (fake *CFPackageRepository) ListPackagesCalls(stub func(context.Context, authorization.Info, repositories.ListPackagesMessage) (repositories.ListResult[repositories.PackageRecord], error)) {
	fake.listPackagesMutex.Lock()
	defer fake.listPackagesMutex.Unlock()
	fake.ListPackagesStub = stub
}

func (fake *CFPackageRepository) ListPackagesArgsForCall(i int) (context.Context, authorization.Info, repositories.ListPackagesMessage) {
	fake.listPackagesMutex.RLock()
	defer fake.listPackagesMutex.RUnlock()
	argsForCall := fake.listPackagesArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}

func (fake *CFPackageRepository) ListPackagesReturns(result1 repositories.ListResult[repositories.PackageRecord], result2 error) {
	fake.listPackagesMutex.Lock()
	defer fake.listPackagesMutex.Unlock()
	fake.ListPackagesStub = nil
	fake.listPackagesReturns = struct {
		result1 repositories.ListResult[repositories.PackageRecord]
		result2 error
	}{result1, result2}
}

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

func (fake *CFPackageRepository) UpdatePackage(arg1 context.Context, arg2 authorization.Info, arg3 repositories.UpdatePackageMessage) (repositories.PackageRecord, error) {
	fake.updatePackageMutex.Lock()
	ret, specificReturn := fake.updatePackageReturnsOnCall[len(fake.updatePackageArgsForCall)]
	fake.updatePackageArgsForCall = append(fake.updatePackageArgsForCall, struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 repositories.UpdatePackageMessage
	}{arg1, arg2, arg3})
	stub := fake.UpdatePackageStub
	fakeReturns := fake.updatePackageReturns
	fake.recordInvocation("UpdatePackage", []interface{}{arg1, arg2, arg3})
	fake.updatePackageMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2, arg3)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *CFPackageRepository) UpdatePackageCallCount() int {
	fake.updatePackageMutex.RLock()
	defer fake.updatePackageMutex.RUnlock()
	return len(fake.updatePackageArgsForCall)
}

func (fake *CFPackageRepository) UpdatePackageCalls(stub func(context.Context, authorization.Info, repositories.UpdatePackageMessage) (repositories.PackageRecord, error)) {
	fake.updatePackageMutex.Lock()
	defer fake.updatePackageMutex.Unlock()
	fake.UpdatePackageStub = stub
}

func (fake *CFPackageRepository) UpdatePackageArgsForCall(i int) (context.Context, authorization.Info, repositories.UpdatePackageMessage) {
	fake.updatePackageMutex.RLock()
	defer fake.updatePackageMutex.RUnlock()
	argsForCall := fake.updatePackageArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}

func (fake *CFPackageRepository) UpdatePackageReturns(result1 repositories.PackageRecord, result2 error) {
	fake.updatePackageMutex.Lock()
	defer fake.updatePackageMutex.Unlock()
	fake.UpdatePackageStub = nil
	fake.updatePackageReturns = struct {
		result1 repositories.PackageRecord
		result2 error
	}{result1, result2}
}

func (fake *CFPackageRepository) UpdatePackageReturnsOnCall(i int, result1 repositories.PackageRecord, result2 error) {
	fake.updatePackageMutex.Lock()
	defer fake.updatePackageMutex.Unlock()
	fake.UpdatePackageStub = nil
	if fake.updatePackageReturnsOnCall == nil {
		fake.updatePackageReturnsOnCall = make(map[int]struct {
			result1 repositories.PackageRecord
			result2 error
		})
	}
	fake.updatePackageReturnsOnCall[i] = struct {
		result1 repositories.PackageRecord
		result2 error
	}{result1, result2}
}

func (fake *CFPackageRepository) UpdatePackageSource(arg1 context.Context, arg2 authorization.Info, arg3 repositories.UpdatePackageSourceMessage) (repositories.PackageRecord, error) {
	fake.updatePackageSourceMutex.Lock()
	ret, specificReturn := fake.updatePackageSourceReturnsOnCall[len(fake.updatePackageSourceArgsForCall)]
	fake.updatePackageSourceArgsForCall = append(fake.updatePackageSourceArgsForCall, struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 repositories.UpdatePackageSourceMessage
	}{arg1, arg2, arg3})
	stub := fake.UpdatePackageSourceStub
	fakeReturns := fake.updatePackageSourceReturns
	fake.recordInvocation("UpdatePackageSource", []interface{}{arg1, arg2, arg3})
	fake.updatePackageSourceMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2, arg3)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *CFPackageRepository) UpdatePackageSourceCallCount() int {
	fake.updatePackageSourceMutex.RLock()
	defer fake.updatePackageSourceMutex.RUnlock()
	return len(fake.updatePackageSourceArgsForCall)
}

func (fake *CFPackageRepository) UpdatePackageSourceCalls(stub func(context.Context, authorization.Info, repositories.UpdatePackageSourceMessage) (repositories.PackageRecord, error)) {
	fake.updatePackageSourceMutex.Lock()
	defer fake.updatePackageSourceMutex.Unlock()
	fake.UpdatePackageSourceStub = stub
}

func (fake *CFPackageRepository) UpdatePackageSourceArgsForCall(i int) (context.Context, authorization.Info, repositories.UpdatePackageSourceMessage) {
	fake.updatePackageSourceMutex.RLock()
	defer fake.updatePackageSourceMutex.RUnlock()
	argsForCall := fake.updatePackageSourceArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}

func (fake *CFPackageRepository) UpdatePackageSourceReturns(result1 repositories.PackageRecord, result2 error) {
	fake.updatePackageSourceMutex.Lock()
	defer fake.updatePackageSourceMutex.Unlock()
	fake.UpdatePackageSourceStub = nil
	fake.updatePackageSourceReturns = struct {
		result1 repositories.PackageRecord
		result2 error
	}{result1, result2}
}

func (fake *CFPackageRepository) UpdatePackageSourceReturnsOnCall(i int, result1 repositories.PackageRecord, result2 error) {
	fake.updatePackageSourceMutex.Lock()
	defer fake.updatePackageSourceMutex.Unlock()
	fake.UpdatePackageSourceStub = nil
	if fake.updatePackageSourceReturnsOnCall == nil {
		fake.updatePackageSourceReturnsOnCall = make(map[int]struct {
			result1 repositories.PackageRecord
			result2 error
		})
	}
	fake.updatePackageSourceReturnsOnCall[i] = struct {
		result1 repositories.PackageRecord
		result2 error
	}{result1, result2}
}

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