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

import (
	"sync"

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

type FakeBroadcaster struct {
	CancelSubscriptionStub        func(string)
	cancelSubscriptionMutex       sync.RWMutex
	cancelSubscriptionArgsForCall []struct {
		arg1 string
	}
	SendStub        func(broadcast.NginxAgentMessage) bool
	sendMutex       sync.RWMutex
	sendArgsForCall []struct {
		arg1 broadcast.NginxAgentMessage
	}
	sendReturns struct {
		result1 bool
	}
	sendReturnsOnCall map[int]struct {
		result1 bool
	}
	SubscribeStub        func() broadcast.SubscriberChannels
	subscribeMutex       sync.RWMutex
	subscribeArgsForCall []struct {
	}
	subscribeReturns struct {
		result1 broadcast.SubscriberChannels
	}
	subscribeReturnsOnCall map[int]struct {
		result1 broadcast.SubscriberChannels
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeBroadcaster) CancelSubscription(arg1 string) {
	fake.cancelSubscriptionMutex.Lock()
	fake.cancelSubscriptionArgsForCall = append(fake.cancelSubscriptionArgsForCall, struct {
		arg1 string
	}{arg1})
	stub := fake.CancelSubscriptionStub
	fake.recordInvocation("CancelSubscription", []interface{}{arg1})
	fake.cancelSubscriptionMutex.Unlock()
	if stub != nil {
		fake.CancelSubscriptionStub(arg1)
	}
}

func (fake *FakeBroadcaster) CancelSubscriptionCallCount() int {
	fake.cancelSubscriptionMutex.RLock()
	defer fake.cancelSubscriptionMutex.RUnlock()
	return len(fake.cancelSubscriptionArgsForCall)
}

func (fake *FakeBroadcaster) CancelSubscriptionCalls(stub func(string)) {
	fake.cancelSubscriptionMutex.Lock()
	defer fake.cancelSubscriptionMutex.Unlock()
	fake.CancelSubscriptionStub = stub
}

func (fake *FakeBroadcaster) CancelSubscriptionArgsForCall(i int) string {
	fake.cancelSubscriptionMutex.RLock()
	defer fake.cancelSubscriptionMutex.RUnlock()
	argsForCall := fake.cancelSubscriptionArgsForCall[i]
	return argsForCall.arg1
}

func (fake *FakeBroadcaster) Send(arg1 broadcast.NginxAgentMessage) bool {
	fake.sendMutex.Lock()
	ret, specificReturn := fake.sendReturnsOnCall[len(fake.sendArgsForCall)]
	fake.sendArgsForCall = append(fake.sendArgsForCall, struct {
		arg1 broadcast.NginxAgentMessage
	}{arg1})
	stub := fake.SendStub
	fakeReturns := fake.sendReturns
	fake.recordInvocation("Send", []interface{}{arg1})
	fake.sendMutex.Unlock()
	if stub != nil {
		return stub(arg1)
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

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

func (fake *FakeBroadcaster) SendCalls(stub func(broadcast.NginxAgentMessage) bool) {
	fake.sendMutex.Lock()
	defer fake.sendMutex.Unlock()
	fake.SendStub = stub
}

func (fake *FakeBroadcaster) SendArgsForCall(i int) broadcast.NginxAgentMessage {
	fake.sendMutex.RLock()
	defer fake.sendMutex.RUnlock()
	argsForCall := fake.sendArgsForCall[i]
	return argsForCall.arg1
}

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

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

func (fake *FakeBroadcaster) Subscribe() broadcast.SubscriberChannels {
	fake.subscribeMutex.Lock()
	ret, specificReturn := fake.subscribeReturnsOnCall[len(fake.subscribeArgsForCall)]
	fake.subscribeArgsForCall = append(fake.subscribeArgsForCall, struct {
	}{})
	stub := fake.SubscribeStub
	fakeReturns := fake.subscribeReturns
	fake.recordInvocation("Subscribe", []interface{}{})
	fake.subscribeMutex.Unlock()
	if stub != nil {
		return stub()
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *FakeBroadcaster) SubscribeCallCount() int {
	fake.subscribeMutex.RLock()
	defer fake.subscribeMutex.RUnlock()
	return len(fake.subscribeArgsForCall)
}

func (fake *FakeBroadcaster) SubscribeCalls(stub func() broadcast.SubscriberChannels) {
	fake.subscribeMutex.Lock()
	defer fake.subscribeMutex.Unlock()
	fake.SubscribeStub = stub
}

func (fake *FakeBroadcaster) SubscribeReturns(result1 broadcast.SubscriberChannels) {
	fake.subscribeMutex.Lock()
	defer fake.subscribeMutex.Unlock()
	fake.SubscribeStub = nil
	fake.subscribeReturns = struct {
		result1 broadcast.SubscriberChannels
	}{result1}
}

func (fake *FakeBroadcaster) SubscribeReturnsOnCall(i int, result1 broadcast.SubscriberChannels) {
	fake.subscribeMutex.Lock()
	defer fake.subscribeMutex.Unlock()
	fake.SubscribeStub = nil
	if fake.subscribeReturnsOnCall == nil {
		fake.subscribeReturnsOnCall = make(map[int]struct {
			result1 broadcast.SubscriberChannels
		})
	}
	fake.subscribeReturnsOnCall[i] = struct {
		result1 broadcast.SubscriberChannels
	}{result1}
}

func (fake *FakeBroadcaster) 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 *FakeBroadcaster) 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 _ broadcast.Broadcaster = new(FakeBroadcaster)
