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

import (
	"context"
	"sync"

	"code.cloudfoundry.org/korifi/api/authorization"
	"code.cloudfoundry.org/korifi/api/repositories/include"
	"code.cloudfoundry.org/korifi/api/repositories/relationships"
)

type ResourceRelationshipRepository struct {
	ListRelatedResourcesStub        func(context.Context, authorization.Info, string, []relationships.Resource) ([]relationships.Resource, error)
	listRelatedResourcesMutex       sync.RWMutex
	listRelatedResourcesArgsForCall []struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 string
		arg4 []relationships.Resource
	}
	listRelatedResourcesReturns struct {
		result1 []relationships.Resource
		result2 error
	}
	listRelatedResourcesReturnsOnCall map[int]struct {
		result1 []relationships.Resource
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *ResourceRelationshipRepository) ListRelatedResources(arg1 context.Context, arg2 authorization.Info, arg3 string, arg4 []relationships.Resource) ([]relationships.Resource, error) {
	var arg4Copy []relationships.Resource
	if arg4 != nil {
		arg4Copy = make([]relationships.Resource, len(arg4))
		copy(arg4Copy, arg4)
	}
	fake.listRelatedResourcesMutex.Lock()
	ret, specificReturn := fake.listRelatedResourcesReturnsOnCall[len(fake.listRelatedResourcesArgsForCall)]
	fake.listRelatedResourcesArgsForCall = append(fake.listRelatedResourcesArgsForCall, struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 string
		arg4 []relationships.Resource
	}{arg1, arg2, arg3, arg4Copy})
	stub := fake.ListRelatedResourcesStub
	fakeReturns := fake.listRelatedResourcesReturns
	fake.recordInvocation("ListRelatedResources", []interface{}{arg1, arg2, arg3, arg4Copy})
	fake.listRelatedResourcesMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2, arg3, arg4)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *ResourceRelationshipRepository) ListRelatedResourcesCallCount() int {
	fake.listRelatedResourcesMutex.RLock()
	defer fake.listRelatedResourcesMutex.RUnlock()
	return len(fake.listRelatedResourcesArgsForCall)
}

func (fake *ResourceRelationshipRepository) ListRelatedResourcesCalls(stub func(context.Context, authorization.Info, string, []relationships.Resource) ([]relationships.Resource, error)) {
	fake.listRelatedResourcesMutex.Lock()
	defer fake.listRelatedResourcesMutex.Unlock()
	fake.ListRelatedResourcesStub = stub
}

func (fake *ResourceRelationshipRepository) ListRelatedResourcesArgsForCall(i int) (context.Context, authorization.Info, string, []relationships.Resource) {
	fake.listRelatedResourcesMutex.RLock()
	defer fake.listRelatedResourcesMutex.RUnlock()
	argsForCall := fake.listRelatedResourcesArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
}

func (fake *ResourceRelationshipRepository) ListRelatedResourcesReturns(result1 []relationships.Resource, result2 error) {
	fake.listRelatedResourcesMutex.Lock()
	defer fake.listRelatedResourcesMutex.Unlock()
	fake.ListRelatedResourcesStub = nil
	fake.listRelatedResourcesReturns = struct {
		result1 []relationships.Resource
		result2 error
	}{result1, result2}
}

func (fake *ResourceRelationshipRepository) ListRelatedResourcesReturnsOnCall(i int, result1 []relationships.Resource, result2 error) {
	fake.listRelatedResourcesMutex.Lock()
	defer fake.listRelatedResourcesMutex.Unlock()
	fake.ListRelatedResourcesStub = nil
	if fake.listRelatedResourcesReturnsOnCall == nil {
		fake.listRelatedResourcesReturnsOnCall = make(map[int]struct {
			result1 []relationships.Resource
			result2 error
		})
	}
	fake.listRelatedResourcesReturnsOnCall[i] = struct {
		result1 []relationships.Resource
		result2 error
	}{result1, result2}
}

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

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