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

import (
	"sync"

	"code.cloudfoundry.org/eirini/bifrost"
	"github.com/containers/image/types"
	v1 "github.com/opencontainers/image-spec/specs-go/v1"
)

type FakeImageMetadataFetcher struct {
	Stub        func(string, types.SystemContext) (*v1.ImageConfig, error)
	mutex       sync.RWMutex
	argsForCall []struct {
		arg1 string
		arg2 types.SystemContext
	}
	returns struct {
		result1 *v1.ImageConfig
		result2 error
	}
	returnsOnCall map[int]struct {
		result1 *v1.ImageConfig
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeImageMetadataFetcher) Spy(arg1 string, arg2 types.SystemContext) (*v1.ImageConfig, error) {
	fake.mutex.Lock()
	ret, specificReturn := fake.returnsOnCall[len(fake.argsForCall)]
	fake.argsForCall = append(fake.argsForCall, struct {
		arg1 string
		arg2 types.SystemContext
	}{arg1, arg2})
	stub := fake.Stub
	returns := fake.returns
	fake.recordInvocation("ImageMetadataFetcher", []interface{}{arg1, arg2})
	fake.mutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return returns.result1, returns.result2
}

func (fake *FakeImageMetadataFetcher) CallCount() int {
	fake.mutex.RLock()
	defer fake.mutex.RUnlock()
	return len(fake.argsForCall)
}

func (fake *FakeImageMetadataFetcher) Calls(stub func(string, types.SystemContext) (*v1.ImageConfig, error)) {
	fake.mutex.Lock()
	defer fake.mutex.Unlock()
	fake.Stub = stub
}

func (fake *FakeImageMetadataFetcher) ArgsForCall(i int) (string, types.SystemContext) {
	fake.mutex.RLock()
	defer fake.mutex.RUnlock()
	return fake.argsForCall[i].arg1, fake.argsForCall[i].arg2
}

func (fake *FakeImageMetadataFetcher) Returns(result1 *v1.ImageConfig, result2 error) {
	fake.mutex.Lock()
	defer fake.mutex.Unlock()
	fake.Stub = nil
	fake.returns = struct {
		result1 *v1.ImageConfig
		result2 error
	}{result1, result2}
}

func (fake *FakeImageMetadataFetcher) ReturnsOnCall(i int, result1 *v1.ImageConfig, result2 error) {
	fake.mutex.Lock()
	defer fake.mutex.Unlock()
	fake.Stub = nil
	if fake.returnsOnCall == nil {
		fake.returnsOnCall = make(map[int]struct {
			result1 *v1.ImageConfig
			result2 error
		})
	}
	fake.returnsOnCall[i] = struct {
		result1 *v1.ImageConfig
		result2 error
	}{result1, result2}
}

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

func (fake *FakeImageMetadataFetcher) 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 _ bifrost.ImageMetadataFetcher = new(FakeImageMetadataFetcher).Spy
