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

import (
	"sync"

	"code.cloudfoundry.org/cli/cf/manifest"
)

type FakeRepository struct {
	ReadManifestStub        func(string) (*manifest.Manifest, error)
	readManifestMutex       sync.RWMutex
	readManifestArgsForCall []struct {
		arg1 string
	}
	readManifestReturns struct {
		result1 *manifest.Manifest
		result2 error
	}
	readManifestReturnsOnCall map[int]struct {
		result1 *manifest.Manifest
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeRepository) ReadManifest(arg1 string) (*manifest.Manifest, error) {
	fake.readManifestMutex.Lock()
	ret, specificReturn := fake.readManifestReturnsOnCall[len(fake.readManifestArgsForCall)]
	fake.readManifestArgsForCall = append(fake.readManifestArgsForCall, struct {
		arg1 string
	}{arg1})
	fake.recordInvocation("ReadManifest", []interface{}{arg1})
	fake.readManifestMutex.Unlock()
	if fake.ReadManifestStub != nil {
		return fake.ReadManifestStub(arg1)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	fakeReturns := fake.readManifestReturns
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *FakeRepository) ReadManifestCallCount() int {
	fake.readManifestMutex.RLock()
	defer fake.readManifestMutex.RUnlock()
	return len(fake.readManifestArgsForCall)
}

func (fake *FakeRepository) ReadManifestCalls(stub func(string) (*manifest.Manifest, error)) {
	fake.readManifestMutex.Lock()
	defer fake.readManifestMutex.Unlock()
	fake.ReadManifestStub = stub
}

func (fake *FakeRepository) ReadManifestArgsForCall(i int) string {
	fake.readManifestMutex.RLock()
	defer fake.readManifestMutex.RUnlock()
	argsForCall := fake.readManifestArgsForCall[i]
	return argsForCall.arg1
}

func (fake *FakeRepository) ReadManifestReturns(result1 *manifest.Manifest, result2 error) {
	fake.readManifestMutex.Lock()
	defer fake.readManifestMutex.Unlock()
	fake.ReadManifestStub = nil
	fake.readManifestReturns = struct {
		result1 *manifest.Manifest
		result2 error
	}{result1, result2}
}

func (fake *FakeRepository) ReadManifestReturnsOnCall(i int, result1 *manifest.Manifest, result2 error) {
	fake.readManifestMutex.Lock()
	defer fake.readManifestMutex.Unlock()
	fake.ReadManifestStub = nil
	if fake.readManifestReturnsOnCall == nil {
		fake.readManifestReturnsOnCall = make(map[int]struct {
			result1 *manifest.Manifest
			result2 error
		})
	}
	fake.readManifestReturnsOnCall[i] = struct {
		result1 *manifest.Manifest
		result2 error
	}{result1, result2}
}

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

func (fake *FakeRepository) 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 _ manifest.Repository = new(FakeRepository)
