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

import (
	"sync"

	"code.cloudfoundry.org/guardian/throttle"
	lager "code.cloudfoundry.org/lager/v3"
)

type FakeEnforcer struct {
	PunishStub        func(lager.Logger, string) error
	punishMutex       sync.RWMutex
	punishArgsForCall []struct {
		arg1 lager.Logger
		arg2 string
	}
	punishReturns struct {
		result1 error
	}
	punishReturnsOnCall map[int]struct {
		result1 error
	}
	ReleaseStub        func(lager.Logger, string) error
	releaseMutex       sync.RWMutex
	releaseArgsForCall []struct {
		arg1 lager.Logger
		arg2 string
	}
	releaseReturns struct {
		result1 error
	}
	releaseReturnsOnCall map[int]struct {
		result1 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeEnforcer) Punish(arg1 lager.Logger, arg2 string) error {
	fake.punishMutex.Lock()
	ret, specificReturn := fake.punishReturnsOnCall[len(fake.punishArgsForCall)]
	fake.punishArgsForCall = append(fake.punishArgsForCall, struct {
		arg1 lager.Logger
		arg2 string
	}{arg1, arg2})
	stub := fake.PunishStub
	fakeReturns := fake.punishReturns
	fake.recordInvocation("Punish", []interface{}{arg1, arg2})
	fake.punishMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *FakeEnforcer) PunishCallCount() int {
	fake.punishMutex.RLock()
	defer fake.punishMutex.RUnlock()
	return len(fake.punishArgsForCall)
}

func (fake *FakeEnforcer) PunishCalls(stub func(lager.Logger, string) error) {
	fake.punishMutex.Lock()
	defer fake.punishMutex.Unlock()
	fake.PunishStub = stub
}

func (fake *FakeEnforcer) PunishArgsForCall(i int) (lager.Logger, string) {
	fake.punishMutex.RLock()
	defer fake.punishMutex.RUnlock()
	argsForCall := fake.punishArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *FakeEnforcer) PunishReturns(result1 error) {
	fake.punishMutex.Lock()
	defer fake.punishMutex.Unlock()
	fake.PunishStub = nil
	fake.punishReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeEnforcer) PunishReturnsOnCall(i int, result1 error) {
	fake.punishMutex.Lock()
	defer fake.punishMutex.Unlock()
	fake.PunishStub = nil
	if fake.punishReturnsOnCall == nil {
		fake.punishReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.punishReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

func (fake *FakeEnforcer) Release(arg1 lager.Logger, arg2 string) error {
	fake.releaseMutex.Lock()
	ret, specificReturn := fake.releaseReturnsOnCall[len(fake.releaseArgsForCall)]
	fake.releaseArgsForCall = append(fake.releaseArgsForCall, struct {
		arg1 lager.Logger
		arg2 string
	}{arg1, arg2})
	stub := fake.ReleaseStub
	fakeReturns := fake.releaseReturns
	fake.recordInvocation("Release", []interface{}{arg1, arg2})
	fake.releaseMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

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

func (fake *FakeEnforcer) ReleaseCalls(stub func(lager.Logger, string) error) {
	fake.releaseMutex.Lock()
	defer fake.releaseMutex.Unlock()
	fake.ReleaseStub = stub
}

func (fake *FakeEnforcer) ReleaseArgsForCall(i int) (lager.Logger, string) {
	fake.releaseMutex.RLock()
	defer fake.releaseMutex.RUnlock()
	argsForCall := fake.releaseArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *FakeEnforcer) ReleaseReturns(result1 error) {
	fake.releaseMutex.Lock()
	defer fake.releaseMutex.Unlock()
	fake.ReleaseStub = nil
	fake.releaseReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeEnforcer) ReleaseReturnsOnCall(i int, result1 error) {
	fake.releaseMutex.Lock()
	defer fake.releaseMutex.Unlock()
	fake.ReleaseStub = nil
	if fake.releaseReturnsOnCall == nil {
		fake.releaseReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.releaseReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

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

func (fake *FakeEnforcer) 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 _ throttle.Enforcer = new(FakeEnforcer)
