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

import (
	"sync"

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

type FakePortPool struct {
	AcquireStub        func() (uint32, error)
	acquireMutex       sync.RWMutex
	acquireArgsForCall []struct {
	}
	acquireReturns struct {
		result1 uint32
		result2 error
	}
	acquireReturnsOnCall map[int]struct {
		result1 uint32
		result2 error
	}
	ReleaseStub        func(uint32)
	releaseMutex       sync.RWMutex
	releaseArgsForCall []struct {
		arg1 uint32
	}
	RemoveStub        func(uint32) error
	removeMutex       sync.RWMutex
	removeArgsForCall []struct {
		arg1 uint32
	}
	removeReturns struct {
		result1 error
	}
	removeReturnsOnCall map[int]struct {
		result1 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakePortPool) Acquire() (uint32, error) {
	fake.acquireMutex.Lock()
	ret, specificReturn := fake.acquireReturnsOnCall[len(fake.acquireArgsForCall)]
	fake.acquireArgsForCall = append(fake.acquireArgsForCall, struct {
	}{})
	stub := fake.AcquireStub
	fakeReturns := fake.acquireReturns
	fake.recordInvocation("Acquire", []interface{}{})
	fake.acquireMutex.Unlock()
	if stub != nil {
		return stub()
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *FakePortPool) AcquireCallCount() int {
	fake.acquireMutex.RLock()
	defer fake.acquireMutex.RUnlock()
	return len(fake.acquireArgsForCall)
}

func (fake *FakePortPool) AcquireCalls(stub func() (uint32, error)) {
	fake.acquireMutex.Lock()
	defer fake.acquireMutex.Unlock()
	fake.AcquireStub = stub
}

func (fake *FakePortPool) AcquireReturns(result1 uint32, result2 error) {
	fake.acquireMutex.Lock()
	defer fake.acquireMutex.Unlock()
	fake.AcquireStub = nil
	fake.acquireReturns = struct {
		result1 uint32
		result2 error
	}{result1, result2}
}

func (fake *FakePortPool) AcquireReturnsOnCall(i int, result1 uint32, result2 error) {
	fake.acquireMutex.Lock()
	defer fake.acquireMutex.Unlock()
	fake.AcquireStub = nil
	if fake.acquireReturnsOnCall == nil {
		fake.acquireReturnsOnCall = make(map[int]struct {
			result1 uint32
			result2 error
		})
	}
	fake.acquireReturnsOnCall[i] = struct {
		result1 uint32
		result2 error
	}{result1, result2}
}

func (fake *FakePortPool) Release(arg1 uint32) {
	fake.releaseMutex.Lock()
	fake.releaseArgsForCall = append(fake.releaseArgsForCall, struct {
		arg1 uint32
	}{arg1})
	stub := fake.ReleaseStub
	fake.recordInvocation("Release", []interface{}{arg1})
	fake.releaseMutex.Unlock()
	if stub != nil {
		fake.ReleaseStub(arg1)
	}
}

func (fake *FakePortPool) ReleaseCallCount() int {
	fake.releaseMutex.RLock()
	defer fake.releaseMutex.RUnlock()
	return len(fake.releaseArgsForCall)
}

func (fake *FakePortPool) ReleaseCalls(stub func(uint32)) {
	fake.releaseMutex.Lock()
	defer fake.releaseMutex.Unlock()
	fake.ReleaseStub = stub
}

func (fake *FakePortPool) ReleaseArgsForCall(i int) uint32 {
	fake.releaseMutex.RLock()
	defer fake.releaseMutex.RUnlock()
	argsForCall := fake.releaseArgsForCall[i]
	return argsForCall.arg1
}

func (fake *FakePortPool) Remove(arg1 uint32) error {
	fake.removeMutex.Lock()
	ret, specificReturn := fake.removeReturnsOnCall[len(fake.removeArgsForCall)]
	fake.removeArgsForCall = append(fake.removeArgsForCall, struct {
		arg1 uint32
	}{arg1})
	stub := fake.RemoveStub
	fakeReturns := fake.removeReturns
	fake.recordInvocation("Remove", []interface{}{arg1})
	fake.removeMutex.Unlock()
	if stub != nil {
		return stub(arg1)
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *FakePortPool) RemoveCallCount() int {
	fake.removeMutex.RLock()
	defer fake.removeMutex.RUnlock()
	return len(fake.removeArgsForCall)
}

func (fake *FakePortPool) RemoveCalls(stub func(uint32) error) {
	fake.removeMutex.Lock()
	defer fake.removeMutex.Unlock()
	fake.RemoveStub = stub
}

func (fake *FakePortPool) RemoveArgsForCall(i int) uint32 {
	fake.removeMutex.RLock()
	defer fake.removeMutex.RUnlock()
	argsForCall := fake.removeArgsForCall[i]
	return argsForCall.arg1
}

func (fake *FakePortPool) RemoveReturns(result1 error) {
	fake.removeMutex.Lock()
	defer fake.removeMutex.Unlock()
	fake.RemoveStub = nil
	fake.removeReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakePortPool) RemoveReturnsOnCall(i int, result1 error) {
	fake.removeMutex.Lock()
	defer fake.removeMutex.Unlock()
	fake.RemoveStub = nil
	if fake.removeReturnsOnCall == nil {
		fake.removeReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.removeReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

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

func (fake *FakePortPool) 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 _ kawasaki.PortPool = new(FakePortPool)
