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

import (
	"net"
	"sync"

	"code.cloudfoundry.org/guardian/kawasaki/subnets"
)

type FakeIPSelector struct {
	SelectIPStub        func(*net.IPNet, []net.IP) (net.IP, error)
	selectIPMutex       sync.RWMutex
	selectIPArgsForCall []struct {
		arg1 *net.IPNet
		arg2 []net.IP
	}
	selectIPReturns struct {
		result1 net.IP
		result2 error
	}
	selectIPReturnsOnCall map[int]struct {
		result1 net.IP
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeIPSelector) SelectIP(arg1 *net.IPNet, arg2 []net.IP) (net.IP, error) {
	var arg2Copy []net.IP
	if arg2 != nil {
		arg2Copy = make([]net.IP, len(arg2))
		copy(arg2Copy, arg2)
	}
	fake.selectIPMutex.Lock()
	ret, specificReturn := fake.selectIPReturnsOnCall[len(fake.selectIPArgsForCall)]
	fake.selectIPArgsForCall = append(fake.selectIPArgsForCall, struct {
		arg1 *net.IPNet
		arg2 []net.IP
	}{arg1, arg2Copy})
	fake.recordInvocation("SelectIP", []interface{}{arg1, arg2Copy})
	fake.selectIPMutex.Unlock()
	if fake.SelectIPStub != nil {
		return fake.SelectIPStub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	fakeReturns := fake.selectIPReturns
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *FakeIPSelector) SelectIPCallCount() int {
	fake.selectIPMutex.RLock()
	defer fake.selectIPMutex.RUnlock()
	return len(fake.selectIPArgsForCall)
}

func (fake *FakeIPSelector) SelectIPCalls(stub func(*net.IPNet, []net.IP) (net.IP, error)) {
	fake.selectIPMutex.Lock()
	defer fake.selectIPMutex.Unlock()
	fake.SelectIPStub = stub
}

func (fake *FakeIPSelector) SelectIPArgsForCall(i int) (*net.IPNet, []net.IP) {
	fake.selectIPMutex.RLock()
	defer fake.selectIPMutex.RUnlock()
	argsForCall := fake.selectIPArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *FakeIPSelector) SelectIPReturns(result1 net.IP, result2 error) {
	fake.selectIPMutex.Lock()
	defer fake.selectIPMutex.Unlock()
	fake.SelectIPStub = nil
	fake.selectIPReturns = struct {
		result1 net.IP
		result2 error
	}{result1, result2}
}

func (fake *FakeIPSelector) SelectIPReturnsOnCall(i int, result1 net.IP, result2 error) {
	fake.selectIPMutex.Lock()
	defer fake.selectIPMutex.Unlock()
	fake.SelectIPStub = nil
	if fake.selectIPReturnsOnCall == nil {
		fake.selectIPReturnsOnCall = make(map[int]struct {
			result1 net.IP
			result2 error
		})
	}
	fake.selectIPReturnsOnCall[i] = struct {
		result1 net.IP
		result2 error
	}{result1, result2}
}

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

func (fake *FakeIPSelector) 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 _ subnets.IPSelector = new(FakeIPSelector)
