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

import (
	"context"
	"sync"

	v1 "github.com/nginx/agent/v3/api/grpc/mpi/v1"
	"github.com/nginx/nginx-gateway-fabric/v2/internal/controller/nginx/agent/grpc/messenger"
)

type FakeMessenger struct {
	ErrorsStub        func() <-chan error
	errorsMutex       sync.RWMutex
	errorsArgsForCall []struct {
	}
	errorsReturns struct {
		result1 <-chan error
	}
	errorsReturnsOnCall map[int]struct {
		result1 <-chan error
	}
	MessagesStub        func() <-chan *v1.DataPlaneResponse
	messagesMutex       sync.RWMutex
	messagesArgsForCall []struct {
	}
	messagesReturns struct {
		result1 <-chan *v1.DataPlaneResponse
	}
	messagesReturnsOnCall map[int]struct {
		result1 <-chan *v1.DataPlaneResponse
	}
	RunStub        func(context.Context)
	runMutex       sync.RWMutex
	runArgsForCall []struct {
		arg1 context.Context
	}
	SendStub        func(context.Context, *v1.ManagementPlaneRequest) error
	sendMutex       sync.RWMutex
	sendArgsForCall []struct {
		arg1 context.Context
		arg2 *v1.ManagementPlaneRequest
	}
	sendReturns struct {
		result1 error
	}
	sendReturnsOnCall map[int]struct {
		result1 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeMessenger) Errors() <-chan error {
	fake.errorsMutex.Lock()
	ret, specificReturn := fake.errorsReturnsOnCall[len(fake.errorsArgsForCall)]
	fake.errorsArgsForCall = append(fake.errorsArgsForCall, struct {
	}{})
	stub := fake.ErrorsStub
	fakeReturns := fake.errorsReturns
	fake.recordInvocation("Errors", []interface{}{})
	fake.errorsMutex.Unlock()
	if stub != nil {
		return stub()
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *FakeMessenger) ErrorsCallCount() int {
	fake.errorsMutex.RLock()
	defer fake.errorsMutex.RUnlock()
	return len(fake.errorsArgsForCall)
}

func (fake *FakeMessenger) ErrorsCalls(stub func() <-chan error) {
	fake.errorsMutex.Lock()
	defer fake.errorsMutex.Unlock()
	fake.ErrorsStub = stub
}

func (fake *FakeMessenger) ErrorsReturns(result1 <-chan error) {
	fake.errorsMutex.Lock()
	defer fake.errorsMutex.Unlock()
	fake.ErrorsStub = nil
	fake.errorsReturns = struct {
		result1 <-chan error
	}{result1}
}

func (fake *FakeMessenger) ErrorsReturnsOnCall(i int, result1 <-chan error) {
	fake.errorsMutex.Lock()
	defer fake.errorsMutex.Unlock()
	fake.ErrorsStub = nil
	if fake.errorsReturnsOnCall == nil {
		fake.errorsReturnsOnCall = make(map[int]struct {
			result1 <-chan error
		})
	}
	fake.errorsReturnsOnCall[i] = struct {
		result1 <-chan error
	}{result1}
}

func (fake *FakeMessenger) Messages() <-chan *v1.DataPlaneResponse {
	fake.messagesMutex.Lock()
	ret, specificReturn := fake.messagesReturnsOnCall[len(fake.messagesArgsForCall)]
	fake.messagesArgsForCall = append(fake.messagesArgsForCall, struct {
	}{})
	stub := fake.MessagesStub
	fakeReturns := fake.messagesReturns
	fake.recordInvocation("Messages", []interface{}{})
	fake.messagesMutex.Unlock()
	if stub != nil {
		return stub()
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *FakeMessenger) MessagesCallCount() int {
	fake.messagesMutex.RLock()
	defer fake.messagesMutex.RUnlock()
	return len(fake.messagesArgsForCall)
}

func (fake *FakeMessenger) MessagesCalls(stub func() <-chan *v1.DataPlaneResponse) {
	fake.messagesMutex.Lock()
	defer fake.messagesMutex.Unlock()
	fake.MessagesStub = stub
}

func (fake *FakeMessenger) MessagesReturns(result1 <-chan *v1.DataPlaneResponse) {
	fake.messagesMutex.Lock()
	defer fake.messagesMutex.Unlock()
	fake.MessagesStub = nil
	fake.messagesReturns = struct {
		result1 <-chan *v1.DataPlaneResponse
	}{result1}
}

func (fake *FakeMessenger) MessagesReturnsOnCall(i int, result1 <-chan *v1.DataPlaneResponse) {
	fake.messagesMutex.Lock()
	defer fake.messagesMutex.Unlock()
	fake.MessagesStub = nil
	if fake.messagesReturnsOnCall == nil {
		fake.messagesReturnsOnCall = make(map[int]struct {
			result1 <-chan *v1.DataPlaneResponse
		})
	}
	fake.messagesReturnsOnCall[i] = struct {
		result1 <-chan *v1.DataPlaneResponse
	}{result1}
}

func (fake *FakeMessenger) Run(arg1 context.Context) {
	fake.runMutex.Lock()
	fake.runArgsForCall = append(fake.runArgsForCall, struct {
		arg1 context.Context
	}{arg1})
	stub := fake.RunStub
	fake.recordInvocation("Run", []interface{}{arg1})
	fake.runMutex.Unlock()
	if stub != nil {
		fake.RunStub(arg1)
	}
}

func (fake *FakeMessenger) RunCallCount() int {
	fake.runMutex.RLock()
	defer fake.runMutex.RUnlock()
	return len(fake.runArgsForCall)
}

func (fake *FakeMessenger) RunCalls(stub func(context.Context)) {
	fake.runMutex.Lock()
	defer fake.runMutex.Unlock()
	fake.RunStub = stub
}

func (fake *FakeMessenger) RunArgsForCall(i int) context.Context {
	fake.runMutex.RLock()
	defer fake.runMutex.RUnlock()
	argsForCall := fake.runArgsForCall[i]
	return argsForCall.arg1
}

func (fake *FakeMessenger) Send(arg1 context.Context, arg2 *v1.ManagementPlaneRequest) error {
	fake.sendMutex.Lock()
	ret, specificReturn := fake.sendReturnsOnCall[len(fake.sendArgsForCall)]
	fake.sendArgsForCall = append(fake.sendArgsForCall, struct {
		arg1 context.Context
		arg2 *v1.ManagementPlaneRequest
	}{arg1, arg2})
	stub := fake.SendStub
	fakeReturns := fake.sendReturns
	fake.recordInvocation("Send", []interface{}{arg1, arg2})
	fake.sendMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *FakeMessenger) SendCallCount() int {
	fake.sendMutex.RLock()
	defer fake.sendMutex.RUnlock()
	return len(fake.sendArgsForCall)
}

func (fake *FakeMessenger) SendCalls(stub func(context.Context, *v1.ManagementPlaneRequest) error) {
	fake.sendMutex.Lock()
	defer fake.sendMutex.Unlock()
	fake.SendStub = stub
}

func (fake *FakeMessenger) SendArgsForCall(i int) (context.Context, *v1.ManagementPlaneRequest) {
	fake.sendMutex.RLock()
	defer fake.sendMutex.RUnlock()
	argsForCall := fake.sendArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *FakeMessenger) SendReturns(result1 error) {
	fake.sendMutex.Lock()
	defer fake.sendMutex.Unlock()
	fake.SendStub = nil
	fake.sendReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeMessenger) SendReturnsOnCall(i int, result1 error) {
	fake.sendMutex.Lock()
	defer fake.sendMutex.Unlock()
	fake.SendStub = nil
	if fake.sendReturnsOnCall == nil {
		fake.sendReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.sendReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

func (fake *FakeMessenger) 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 *FakeMessenger) 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 _ messenger.Messenger = new(FakeMessenger)
