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

import (
	"sync"

	"code.cloudfoundry.org/service-discovery-controller/mbus"
	nats "github.com/nats-io/go-nats"
)

type NatsConnProvider struct {
	ConnectionStub        func(...nats.Option) (mbus.NatsConn, error)
	connectionMutex       sync.RWMutex
	connectionArgsForCall []struct {
		arg1 []nats.Option
	}
	connectionReturns struct {
		result1 mbus.NatsConn
		result2 error
	}
	connectionReturnsOnCall map[int]struct {
		result1 mbus.NatsConn
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *NatsConnProvider) Connection(arg1 ...nats.Option) (mbus.NatsConn, error) {
	fake.connectionMutex.Lock()
	ret, specificReturn := fake.connectionReturnsOnCall[len(fake.connectionArgsForCall)]
	fake.connectionArgsForCall = append(fake.connectionArgsForCall, struct {
		arg1 []nats.Option
	}{arg1})
	stub := fake.ConnectionStub
	fakeReturns := fake.connectionReturns
	fake.recordInvocation("Connection", []interface{}{arg1})
	fake.connectionMutex.Unlock()
	if stub != nil {
		return stub(arg1...)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *NatsConnProvider) ConnectionCallCount() int {
	fake.connectionMutex.RLock()
	defer fake.connectionMutex.RUnlock()
	return len(fake.connectionArgsForCall)
}

func (fake *NatsConnProvider) ConnectionCalls(stub func(...nats.Option) (mbus.NatsConn, error)) {
	fake.connectionMutex.Lock()
	defer fake.connectionMutex.Unlock()
	fake.ConnectionStub = stub
}

func (fake *NatsConnProvider) ConnectionArgsForCall(i int) []nats.Option {
	fake.connectionMutex.RLock()
	defer fake.connectionMutex.RUnlock()
	argsForCall := fake.connectionArgsForCall[i]
	return argsForCall.arg1
}

func (fake *NatsConnProvider) ConnectionReturns(result1 mbus.NatsConn, result2 error) {
	fake.connectionMutex.Lock()
	defer fake.connectionMutex.Unlock()
	fake.ConnectionStub = nil
	fake.connectionReturns = struct {
		result1 mbus.NatsConn
		result2 error
	}{result1, result2}
}

func (fake *NatsConnProvider) ConnectionReturnsOnCall(i int, result1 mbus.NatsConn, result2 error) {
	fake.connectionMutex.Lock()
	defer fake.connectionMutex.Unlock()
	fake.ConnectionStub = nil
	if fake.connectionReturnsOnCall == nil {
		fake.connectionReturnsOnCall = make(map[int]struct {
			result1 mbus.NatsConn
			result2 error
		})
	}
	fake.connectionReturnsOnCall[i] = struct {
		result1 mbus.NatsConn
		result2 error
	}{result1, result2}
}

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

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