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

import (
	"sync"

	"github.com/nginx/nginx-gateway-fabric/v2/internal/controller/nginx/agent"
	"github.com/nginx/nginx-gateway-fabric/v2/internal/controller/state/dataplane"
)

type FakeNginxUpdater struct {
	UpdateConfigStub        func(*agent.Deployment, []agent.File)
	updateConfigMutex       sync.RWMutex
	updateConfigArgsForCall []struct {
		arg1 *agent.Deployment
		arg2 []agent.File
	}
	UpdateUpstreamServersStub        func(*agent.Deployment, dataplane.Configuration)
	updateUpstreamServersMutex       sync.RWMutex
	updateUpstreamServersArgsForCall []struct {
		arg1 *agent.Deployment
		arg2 dataplane.Configuration
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeNginxUpdater) UpdateConfig(arg1 *agent.Deployment, arg2 []agent.File) {
	var arg2Copy []agent.File
	if arg2 != nil {
		arg2Copy = make([]agent.File, len(arg2))
		copy(arg2Copy, arg2)
	}
	fake.updateConfigMutex.Lock()
	fake.updateConfigArgsForCall = append(fake.updateConfigArgsForCall, struct {
		arg1 *agent.Deployment
		arg2 []agent.File
	}{arg1, arg2Copy})
	stub := fake.UpdateConfigStub
	fake.recordInvocation("UpdateConfig", []interface{}{arg1, arg2Copy})
	fake.updateConfigMutex.Unlock()
	if stub != nil {
		fake.UpdateConfigStub(arg1, arg2)
	}
}

func (fake *FakeNginxUpdater) UpdateConfigCallCount() int {
	fake.updateConfigMutex.RLock()
	defer fake.updateConfigMutex.RUnlock()
	return len(fake.updateConfigArgsForCall)
}

func (fake *FakeNginxUpdater) UpdateConfigCalls(stub func(*agent.Deployment, []agent.File)) {
	fake.updateConfigMutex.Lock()
	defer fake.updateConfigMutex.Unlock()
	fake.UpdateConfigStub = stub
}

func (fake *FakeNginxUpdater) UpdateConfigArgsForCall(i int) (*agent.Deployment, []agent.File) {
	fake.updateConfigMutex.RLock()
	defer fake.updateConfigMutex.RUnlock()
	argsForCall := fake.updateConfigArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *FakeNginxUpdater) UpdateUpstreamServers(arg1 *agent.Deployment, arg2 dataplane.Configuration) {
	fake.updateUpstreamServersMutex.Lock()
	fake.updateUpstreamServersArgsForCall = append(fake.updateUpstreamServersArgsForCall, struct {
		arg1 *agent.Deployment
		arg2 dataplane.Configuration
	}{arg1, arg2})
	stub := fake.UpdateUpstreamServersStub
	fake.recordInvocation("UpdateUpstreamServers", []interface{}{arg1, arg2})
	fake.updateUpstreamServersMutex.Unlock()
	if stub != nil {
		fake.UpdateUpstreamServersStub(arg1, arg2)
	}
}

func (fake *FakeNginxUpdater) UpdateUpstreamServersCallCount() int {
	fake.updateUpstreamServersMutex.RLock()
	defer fake.updateUpstreamServersMutex.RUnlock()
	return len(fake.updateUpstreamServersArgsForCall)
}

func (fake *FakeNginxUpdater) UpdateUpstreamServersCalls(stub func(*agent.Deployment, dataplane.Configuration)) {
	fake.updateUpstreamServersMutex.Lock()
	defer fake.updateUpstreamServersMutex.Unlock()
	fake.UpdateUpstreamServersStub = stub
}

func (fake *FakeNginxUpdater) UpdateUpstreamServersArgsForCall(i int) (*agent.Deployment, dataplane.Configuration) {
	fake.updateUpstreamServersMutex.RLock()
	defer fake.updateUpstreamServersMutex.RUnlock()
	argsForCall := fake.updateUpstreamServersArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *FakeNginxUpdater) 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 *FakeNginxUpdater) 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 _ agent.NginxUpdater = new(FakeNginxUpdater)
