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

import (
	"net"
	"sync"

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

type FakeSubnetSelector struct {
	SelectSubnetStub        func(*net.IPNet, []*net.IPNet) (*net.IPNet, error)
	selectSubnetMutex       sync.RWMutex
	selectSubnetArgsForCall []struct {
		arg1 *net.IPNet
		arg2 []*net.IPNet
	}
	selectSubnetReturns struct {
		result1 *net.IPNet
		result2 error
	}
	selectSubnetReturnsOnCall map[int]struct {
		result1 *net.IPNet
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeSubnetSelector) SelectSubnet(arg1 *net.IPNet, arg2 []*net.IPNet) (*net.IPNet, error) {
	var arg2Copy []*net.IPNet
	if arg2 != nil {
		arg2Copy = make([]*net.IPNet, len(arg2))
		copy(arg2Copy, arg2)
	}
	fake.selectSubnetMutex.Lock()
	ret, specificReturn := fake.selectSubnetReturnsOnCall[len(fake.selectSubnetArgsForCall)]
	fake.selectSubnetArgsForCall = append(fake.selectSubnetArgsForCall, struct {
		arg1 *net.IPNet
		arg2 []*net.IPNet
	}{arg1, arg2Copy})
	fake.recordInvocation("SelectSubnet", []interface{}{arg1, arg2Copy})
	fake.selectSubnetMutex.Unlock()
	if fake.SelectSubnetStub != nil {
		return fake.SelectSubnetStub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	fakeReturns := fake.selectSubnetReturns
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *FakeSubnetSelector) SelectSubnetCallCount() int {
	fake.selectSubnetMutex.RLock()
	defer fake.selectSubnetMutex.RUnlock()
	return len(fake.selectSubnetArgsForCall)
}

func (fake *FakeSubnetSelector) SelectSubnetCalls(stub func(*net.IPNet, []*net.IPNet) (*net.IPNet, error)) {
	fake.selectSubnetMutex.Lock()
	defer fake.selectSubnetMutex.Unlock()
	fake.SelectSubnetStub = stub
}

func (fake *FakeSubnetSelector) SelectSubnetArgsForCall(i int) (*net.IPNet, []*net.IPNet) {
	fake.selectSubnetMutex.RLock()
	defer fake.selectSubnetMutex.RUnlock()
	argsForCall := fake.selectSubnetArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *FakeSubnetSelector) SelectSubnetReturns(result1 *net.IPNet, result2 error) {
	fake.selectSubnetMutex.Lock()
	defer fake.selectSubnetMutex.Unlock()
	fake.SelectSubnetStub = nil
	fake.selectSubnetReturns = struct {
		result1 *net.IPNet
		result2 error
	}{result1, result2}
}

func (fake *FakeSubnetSelector) SelectSubnetReturnsOnCall(i int, result1 *net.IPNet, result2 error) {
	fake.selectSubnetMutex.Lock()
	defer fake.selectSubnetMutex.Unlock()
	fake.SelectSubnetStub = nil
	if fake.selectSubnetReturnsOnCall == nil {
		fake.selectSubnetReturnsOnCall = make(map[int]struct {
			result1 *net.IPNet
			result2 error
		})
	}
	fake.selectSubnetReturnsOnCall[i] = struct {
		result1 *net.IPNet
		result2 error
	}{result1, result2}
}

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

func (fake *FakeSubnetSelector) 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.SubnetSelector = new(FakeSubnetSelector)
