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

import (
	"sync"

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

type FakeConnectionsTracker struct {
	GetConnectionStub        func(string) grpc.Connection
	getConnectionMutex       sync.RWMutex
	getConnectionArgsForCall []struct {
		arg1 string
	}
	getConnectionReturns struct {
		result1 grpc.Connection
	}
	getConnectionReturnsOnCall map[int]struct {
		result1 grpc.Connection
	}
	RemoveConnectionStub        func(string)
	removeConnectionMutex       sync.RWMutex
	removeConnectionArgsForCall []struct {
		arg1 string
	}
	SetInstanceIDStub        func(string, string)
	setInstanceIDMutex       sync.RWMutex
	setInstanceIDArgsForCall []struct {
		arg1 string
		arg2 string
	}
	TrackStub        func(string, grpc.Connection)
	trackMutex       sync.RWMutex
	trackArgsForCall []struct {
		arg1 string
		arg2 grpc.Connection
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeConnectionsTracker) GetConnection(arg1 string) grpc.Connection {
	fake.getConnectionMutex.Lock()
	ret, specificReturn := fake.getConnectionReturnsOnCall[len(fake.getConnectionArgsForCall)]
	fake.getConnectionArgsForCall = append(fake.getConnectionArgsForCall, struct {
		arg1 string
	}{arg1})
	stub := fake.GetConnectionStub
	fakeReturns := fake.getConnectionReturns
	fake.recordInvocation("GetConnection", []interface{}{arg1})
	fake.getConnectionMutex.Unlock()
	if stub != nil {
		return stub(arg1)
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *FakeConnectionsTracker) GetConnectionCallCount() int {
	fake.getConnectionMutex.RLock()
	defer fake.getConnectionMutex.RUnlock()
	return len(fake.getConnectionArgsForCall)
}

func (fake *FakeConnectionsTracker) GetConnectionCalls(stub func(string) grpc.Connection) {
	fake.getConnectionMutex.Lock()
	defer fake.getConnectionMutex.Unlock()
	fake.GetConnectionStub = stub
}

func (fake *FakeConnectionsTracker) GetConnectionArgsForCall(i int) string {
	fake.getConnectionMutex.RLock()
	defer fake.getConnectionMutex.RUnlock()
	argsForCall := fake.getConnectionArgsForCall[i]
	return argsForCall.arg1
}

func (fake *FakeConnectionsTracker) GetConnectionReturns(result1 grpc.Connection) {
	fake.getConnectionMutex.Lock()
	defer fake.getConnectionMutex.Unlock()
	fake.GetConnectionStub = nil
	fake.getConnectionReturns = struct {
		result1 grpc.Connection
	}{result1}
}

func (fake *FakeConnectionsTracker) GetConnectionReturnsOnCall(i int, result1 grpc.Connection) {
	fake.getConnectionMutex.Lock()
	defer fake.getConnectionMutex.Unlock()
	fake.GetConnectionStub = nil
	if fake.getConnectionReturnsOnCall == nil {
		fake.getConnectionReturnsOnCall = make(map[int]struct {
			result1 grpc.Connection
		})
	}
	fake.getConnectionReturnsOnCall[i] = struct {
		result1 grpc.Connection
	}{result1}
}

func (fake *FakeConnectionsTracker) RemoveConnection(arg1 string) {
	fake.removeConnectionMutex.Lock()
	fake.removeConnectionArgsForCall = append(fake.removeConnectionArgsForCall, struct {
		arg1 string
	}{arg1})
	stub := fake.RemoveConnectionStub
	fake.recordInvocation("RemoveConnection", []interface{}{arg1})
	fake.removeConnectionMutex.Unlock()
	if stub != nil {
		fake.RemoveConnectionStub(arg1)
	}
}

func (fake *FakeConnectionsTracker) RemoveConnectionCallCount() int {
	fake.removeConnectionMutex.RLock()
	defer fake.removeConnectionMutex.RUnlock()
	return len(fake.removeConnectionArgsForCall)
}

func (fake *FakeConnectionsTracker) RemoveConnectionCalls(stub func(string)) {
	fake.removeConnectionMutex.Lock()
	defer fake.removeConnectionMutex.Unlock()
	fake.RemoveConnectionStub = stub
}

func (fake *FakeConnectionsTracker) RemoveConnectionArgsForCall(i int) string {
	fake.removeConnectionMutex.RLock()
	defer fake.removeConnectionMutex.RUnlock()
	argsForCall := fake.removeConnectionArgsForCall[i]
	return argsForCall.arg1
}

func (fake *FakeConnectionsTracker) SetInstanceID(arg1 string, arg2 string) {
	fake.setInstanceIDMutex.Lock()
	fake.setInstanceIDArgsForCall = append(fake.setInstanceIDArgsForCall, struct {
		arg1 string
		arg2 string
	}{arg1, arg2})
	stub := fake.SetInstanceIDStub
	fake.recordInvocation("SetInstanceID", []interface{}{arg1, arg2})
	fake.setInstanceIDMutex.Unlock()
	if stub != nil {
		fake.SetInstanceIDStub(arg1, arg2)
	}
}

func (fake *FakeConnectionsTracker) SetInstanceIDCallCount() int {
	fake.setInstanceIDMutex.RLock()
	defer fake.setInstanceIDMutex.RUnlock()
	return len(fake.setInstanceIDArgsForCall)
}

func (fake *FakeConnectionsTracker) SetInstanceIDCalls(stub func(string, string)) {
	fake.setInstanceIDMutex.Lock()
	defer fake.setInstanceIDMutex.Unlock()
	fake.SetInstanceIDStub = stub
}

func (fake *FakeConnectionsTracker) SetInstanceIDArgsForCall(i int) (string, string) {
	fake.setInstanceIDMutex.RLock()
	defer fake.setInstanceIDMutex.RUnlock()
	argsForCall := fake.setInstanceIDArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *FakeConnectionsTracker) Track(arg1 string, arg2 grpc.Connection) {
	fake.trackMutex.Lock()
	fake.trackArgsForCall = append(fake.trackArgsForCall, struct {
		arg1 string
		arg2 grpc.Connection
	}{arg1, arg2})
	stub := fake.TrackStub
	fake.recordInvocation("Track", []interface{}{arg1, arg2})
	fake.trackMutex.Unlock()
	if stub != nil {
		fake.TrackStub(arg1, arg2)
	}
}

func (fake *FakeConnectionsTracker) TrackCallCount() int {
	fake.trackMutex.RLock()
	defer fake.trackMutex.RUnlock()
	return len(fake.trackArgsForCall)
}

func (fake *FakeConnectionsTracker) TrackCalls(stub func(string, grpc.Connection)) {
	fake.trackMutex.Lock()
	defer fake.trackMutex.Unlock()
	fake.TrackStub = stub
}

func (fake *FakeConnectionsTracker) TrackArgsForCall(i int) (string, grpc.Connection) {
	fake.trackMutex.RLock()
	defer fake.trackMutex.RUnlock()
	argsForCall := fake.trackArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *FakeConnectionsTracker) 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 *FakeConnectionsTracker) 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 _ grpc.ConnectionsTracker = new(FakeConnectionsTracker)
