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

import (
	"sync"

	"github.com/google/go-containerregistry/pkg/authn"
	"github.com/pivotal/kpack/pkg/apis/build/v1alpha2"
	"github.com/pivotal/kpack/pkg/reconciler/clusterlifecycle"
)

type FakeClusterLifecycleReader struct {
	ReadStub        func(authn.Keychain, v1alpha2.ClusterLifecycleSpec) (v1alpha2.ResolvedClusterLifecycle, error)
	readMutex       sync.RWMutex
	readArgsForCall []struct {
		arg1 authn.Keychain
		arg2 v1alpha2.ClusterLifecycleSpec
	}
	readReturns struct {
		result1 v1alpha2.ResolvedClusterLifecycle
		result2 error
	}
	readReturnsOnCall map[int]struct {
		result1 v1alpha2.ResolvedClusterLifecycle
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeClusterLifecycleReader) Read(arg1 authn.Keychain, arg2 v1alpha2.ClusterLifecycleSpec) (v1alpha2.ResolvedClusterLifecycle, error) {
	fake.readMutex.Lock()
	ret, specificReturn := fake.readReturnsOnCall[len(fake.readArgsForCall)]
	fake.readArgsForCall = append(fake.readArgsForCall, struct {
		arg1 authn.Keychain
		arg2 v1alpha2.ClusterLifecycleSpec
	}{arg1, arg2})
	stub := fake.ReadStub
	fakeReturns := fake.readReturns
	fake.recordInvocation("Read", []interface{}{arg1, arg2})
	fake.readMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *FakeClusterLifecycleReader) ReadCallCount() int {
	fake.readMutex.RLock()
	defer fake.readMutex.RUnlock()
	return len(fake.readArgsForCall)
}

func (fake *FakeClusterLifecycleReader) ReadCalls(stub func(authn.Keychain, v1alpha2.ClusterLifecycleSpec) (v1alpha2.ResolvedClusterLifecycle, error)) {
	fake.readMutex.Lock()
	defer fake.readMutex.Unlock()
	fake.ReadStub = stub
}

func (fake *FakeClusterLifecycleReader) ReadArgsForCall(i int) (authn.Keychain, v1alpha2.ClusterLifecycleSpec) {
	fake.readMutex.RLock()
	defer fake.readMutex.RUnlock()
	argsForCall := fake.readArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *FakeClusterLifecycleReader) ReadReturns(result1 v1alpha2.ResolvedClusterLifecycle, result2 error) {
	fake.readMutex.Lock()
	defer fake.readMutex.Unlock()
	fake.ReadStub = nil
	fake.readReturns = struct {
		result1 v1alpha2.ResolvedClusterLifecycle
		result2 error
	}{result1, result2}
}

func (fake *FakeClusterLifecycleReader) ReadReturnsOnCall(i int, result1 v1alpha2.ResolvedClusterLifecycle, result2 error) {
	fake.readMutex.Lock()
	defer fake.readMutex.Unlock()
	fake.ReadStub = nil
	if fake.readReturnsOnCall == nil {
		fake.readReturnsOnCall = make(map[int]struct {
			result1 v1alpha2.ResolvedClusterLifecycle
			result2 error
		})
	}
	fake.readReturnsOnCall[i] = struct {
		result1 v1alpha2.ResolvedClusterLifecycle
		result2 error
	}{result1, result2}
}

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

func (fake *FakeClusterLifecycleReader) 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 _ clusterlifecycle.ClusterLifecycleReader = new(FakeClusterLifecycleReader)
