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

import (
	"sync"

	"github.com/cloudfoundry/bosh-agent/v2/agent/applier/models"
	"github.com/cloudfoundry/bosh-agent/v2/agent/compiler"
	"github.com/cloudfoundry/bosh-utils/crypto"
)

type Compiler struct {
	CompileStub        func(compiler.Package, []models.Package) (string, crypto.Digest, error)
	compileMutex       sync.RWMutex
	compileArgsForCall []struct {
		arg1 compiler.Package
		arg2 []models.Package
	}
	compileReturns struct {
		result1 string
		result2 crypto.Digest
		result3 error
	}
	compileReturnsOnCall map[int]struct {
		result1 string
		result2 crypto.Digest
		result3 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *Compiler) Compile(arg1 compiler.Package, arg2 []models.Package) (string, crypto.Digest, error) {
	var arg2Copy []models.Package
	if arg2 != nil {
		arg2Copy = make([]models.Package, len(arg2))
		copy(arg2Copy, arg2)
	}
	fake.compileMutex.Lock()
	ret, specificReturn := fake.compileReturnsOnCall[len(fake.compileArgsForCall)]
	fake.compileArgsForCall = append(fake.compileArgsForCall, struct {
		arg1 compiler.Package
		arg2 []models.Package
	}{arg1, arg2Copy})
	stub := fake.CompileStub
	fakeReturns := fake.compileReturns
	fake.recordInvocation("Compile", []interface{}{arg1, arg2Copy})
	fake.compileMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1, ret.result2, ret.result3
	}
	return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3
}

func (fake *Compiler) CompileCallCount() int {
	fake.compileMutex.RLock()
	defer fake.compileMutex.RUnlock()
	return len(fake.compileArgsForCall)
}

func (fake *Compiler) CompileCalls(stub func(compiler.Package, []models.Package) (string, crypto.Digest, error)) {
	fake.compileMutex.Lock()
	defer fake.compileMutex.Unlock()
	fake.CompileStub = stub
}

func (fake *Compiler) CompileArgsForCall(i int) (compiler.Package, []models.Package) {
	fake.compileMutex.RLock()
	defer fake.compileMutex.RUnlock()
	argsForCall := fake.compileArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *Compiler) CompileReturns(result1 string, result2 crypto.Digest, result3 error) {
	fake.compileMutex.Lock()
	defer fake.compileMutex.Unlock()
	fake.CompileStub = nil
	fake.compileReturns = struct {
		result1 string
		result2 crypto.Digest
		result3 error
	}{result1, result2, result3}
}

func (fake *Compiler) CompileReturnsOnCall(i int, result1 string, result2 crypto.Digest, result3 error) {
	fake.compileMutex.Lock()
	defer fake.compileMutex.Unlock()
	fake.CompileStub = nil
	if fake.compileReturnsOnCall == nil {
		fake.compileReturnsOnCall = make(map[int]struct {
			result1 string
			result2 crypto.Digest
			result3 error
		})
	}
	fake.compileReturnsOnCall[i] = struct {
		result1 string
		result2 crypto.Digest
		result3 error
	}{result1, result2, result3}
}

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

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