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

import (
	"os"
	"sync"

	"code.cloudfoundry.org/cli/cf/api/applicationbits"
	"code.cloudfoundry.org/cli/cf/api/resources"
)

type FakeRepository struct {
	GetApplicationFilesStub        func([]resources.AppFileResource) ([]resources.AppFileResource, error)
	getApplicationFilesMutex       sync.RWMutex
	getApplicationFilesArgsForCall []struct {
		arg1 []resources.AppFileResource
	}
	getApplicationFilesReturns struct {
		result1 []resources.AppFileResource
		result2 error
	}
	getApplicationFilesReturnsOnCall map[int]struct {
		result1 []resources.AppFileResource
		result2 error
	}
	UploadBitsStub        func(string, *os.File, []resources.AppFileResource) error
	uploadBitsMutex       sync.RWMutex
	uploadBitsArgsForCall []struct {
		arg1 string
		arg2 *os.File
		arg3 []resources.AppFileResource
	}
	uploadBitsReturns struct {
		result1 error
	}
	uploadBitsReturnsOnCall map[int]struct {
		result1 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeRepository) GetApplicationFiles(arg1 []resources.AppFileResource) ([]resources.AppFileResource, error) {
	var arg1Copy []resources.AppFileResource
	if arg1 != nil {
		arg1Copy = make([]resources.AppFileResource, len(arg1))
		copy(arg1Copy, arg1)
	}
	fake.getApplicationFilesMutex.Lock()
	ret, specificReturn := fake.getApplicationFilesReturnsOnCall[len(fake.getApplicationFilesArgsForCall)]
	fake.getApplicationFilesArgsForCall = append(fake.getApplicationFilesArgsForCall, struct {
		arg1 []resources.AppFileResource
	}{arg1Copy})
	fake.recordInvocation("GetApplicationFiles", []interface{}{arg1Copy})
	fake.getApplicationFilesMutex.Unlock()
	if fake.GetApplicationFilesStub != nil {
		return fake.GetApplicationFilesStub(arg1)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	fakeReturns := fake.getApplicationFilesReturns
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *FakeRepository) GetApplicationFilesCallCount() int {
	fake.getApplicationFilesMutex.RLock()
	defer fake.getApplicationFilesMutex.RUnlock()
	return len(fake.getApplicationFilesArgsForCall)
}

func (fake *FakeRepository) GetApplicationFilesCalls(stub func([]resources.AppFileResource) ([]resources.AppFileResource, error)) {
	fake.getApplicationFilesMutex.Lock()
	defer fake.getApplicationFilesMutex.Unlock()
	fake.GetApplicationFilesStub = stub
}

func (fake *FakeRepository) GetApplicationFilesArgsForCall(i int) []resources.AppFileResource {
	fake.getApplicationFilesMutex.RLock()
	defer fake.getApplicationFilesMutex.RUnlock()
	argsForCall := fake.getApplicationFilesArgsForCall[i]
	return argsForCall.arg1
}

func (fake *FakeRepository) GetApplicationFilesReturns(result1 []resources.AppFileResource, result2 error) {
	fake.getApplicationFilesMutex.Lock()
	defer fake.getApplicationFilesMutex.Unlock()
	fake.GetApplicationFilesStub = nil
	fake.getApplicationFilesReturns = struct {
		result1 []resources.AppFileResource
		result2 error
	}{result1, result2}
}

func (fake *FakeRepository) GetApplicationFilesReturnsOnCall(i int, result1 []resources.AppFileResource, result2 error) {
	fake.getApplicationFilesMutex.Lock()
	defer fake.getApplicationFilesMutex.Unlock()
	fake.GetApplicationFilesStub = nil
	if fake.getApplicationFilesReturnsOnCall == nil {
		fake.getApplicationFilesReturnsOnCall = make(map[int]struct {
			result1 []resources.AppFileResource
			result2 error
		})
	}
	fake.getApplicationFilesReturnsOnCall[i] = struct {
		result1 []resources.AppFileResource
		result2 error
	}{result1, result2}
}

func (fake *FakeRepository) UploadBits(arg1 string, arg2 *os.File, arg3 []resources.AppFileResource) error {
	var arg3Copy []resources.AppFileResource
	if arg3 != nil {
		arg3Copy = make([]resources.AppFileResource, len(arg3))
		copy(arg3Copy, arg3)
	}
	fake.uploadBitsMutex.Lock()
	ret, specificReturn := fake.uploadBitsReturnsOnCall[len(fake.uploadBitsArgsForCall)]
	fake.uploadBitsArgsForCall = append(fake.uploadBitsArgsForCall, struct {
		arg1 string
		arg2 *os.File
		arg3 []resources.AppFileResource
	}{arg1, arg2, arg3Copy})
	fake.recordInvocation("UploadBits", []interface{}{arg1, arg2, arg3Copy})
	fake.uploadBitsMutex.Unlock()
	if fake.UploadBitsStub != nil {
		return fake.UploadBitsStub(arg1, arg2, arg3)
	}
	if specificReturn {
		return ret.result1
	}
	fakeReturns := fake.uploadBitsReturns
	return fakeReturns.result1
}

func (fake *FakeRepository) UploadBitsCallCount() int {
	fake.uploadBitsMutex.RLock()
	defer fake.uploadBitsMutex.RUnlock()
	return len(fake.uploadBitsArgsForCall)
}

func (fake *FakeRepository) UploadBitsCalls(stub func(string, *os.File, []resources.AppFileResource) error) {
	fake.uploadBitsMutex.Lock()
	defer fake.uploadBitsMutex.Unlock()
	fake.UploadBitsStub = stub
}

func (fake *FakeRepository) UploadBitsArgsForCall(i int) (string, *os.File, []resources.AppFileResource) {
	fake.uploadBitsMutex.RLock()
	defer fake.uploadBitsMutex.RUnlock()
	argsForCall := fake.uploadBitsArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}

func (fake *FakeRepository) UploadBitsReturns(result1 error) {
	fake.uploadBitsMutex.Lock()
	defer fake.uploadBitsMutex.Unlock()
	fake.UploadBitsStub = nil
	fake.uploadBitsReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeRepository) UploadBitsReturnsOnCall(i int, result1 error) {
	fake.uploadBitsMutex.Lock()
	defer fake.uploadBitsMutex.Unlock()
	fake.UploadBitsStub = nil
	if fake.uploadBitsReturnsOnCall == nil {
		fake.uploadBitsReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.uploadBitsReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

func (fake *FakeRepository) Invocations() map[string][][]interface{} {
	fake.invocationsMutex.RLock()
	defer fake.invocationsMutex.RUnlock()
	fake.getApplicationFilesMutex.RLock()
	defer fake.getApplicationFilesMutex.RUnlock()
	fake.uploadBitsMutex.RLock()
	defer fake.uploadBitsMutex.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 _ applicationbits.Repository = new(FakeRepository)
