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

import (
	"policy-server/store"
	"policy-server/uaa_client"
	"sync"
)

type QuotaGuard struct {
	CheckAccessStub        func(policies []store.Policy, tokenData uaa_client.CheckTokenResponse) (bool, error)
	checkAccessMutex       sync.RWMutex
	checkAccessArgsForCall []struct {
		policies  []store.Policy
		tokenData uaa_client.CheckTokenResponse
	}
	checkAccessReturns struct {
		result1 bool
		result2 error
	}
	checkAccessReturnsOnCall map[int]struct {
		result1 bool
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *QuotaGuard) CheckAccess(policies []store.Policy, tokenData uaa_client.CheckTokenResponse) (bool, error) {
	var policiesCopy []store.Policy
	if policies != nil {
		policiesCopy = make([]store.Policy, len(policies))
		copy(policiesCopy, policies)
	}
	fake.checkAccessMutex.Lock()
	ret, specificReturn := fake.checkAccessReturnsOnCall[len(fake.checkAccessArgsForCall)]
	fake.checkAccessArgsForCall = append(fake.checkAccessArgsForCall, struct {
		policies  []store.Policy
		tokenData uaa_client.CheckTokenResponse
	}{policiesCopy, tokenData})
	fake.recordInvocation("CheckAccess", []interface{}{policiesCopy, tokenData})
	fake.checkAccessMutex.Unlock()
	if fake.CheckAccessStub != nil {
		return fake.CheckAccessStub(policies, tokenData)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fake.checkAccessReturns.result1, fake.checkAccessReturns.result2
}

func (fake *QuotaGuard) CheckAccessCallCount() int {
	fake.checkAccessMutex.RLock()
	defer fake.checkAccessMutex.RUnlock()
	return len(fake.checkAccessArgsForCall)
}

func (fake *QuotaGuard) CheckAccessArgsForCall(i int) ([]store.Policy, uaa_client.CheckTokenResponse) {
	fake.checkAccessMutex.RLock()
	defer fake.checkAccessMutex.RUnlock()
	return fake.checkAccessArgsForCall[i].policies, fake.checkAccessArgsForCall[i].tokenData
}

func (fake *QuotaGuard) CheckAccessReturns(result1 bool, result2 error) {
	fake.CheckAccessStub = nil
	fake.checkAccessReturns = struct {
		result1 bool
		result2 error
	}{result1, result2}
}

func (fake *QuotaGuard) CheckAccessReturnsOnCall(i int, result1 bool, result2 error) {
	fake.CheckAccessStub = nil
	if fake.checkAccessReturnsOnCall == nil {
		fake.checkAccessReturnsOnCall = make(map[int]struct {
			result1 bool
			result2 error
		})
	}
	fake.checkAccessReturnsOnCall[i] = struct {
		result1 bool
		result2 error
	}{result1, result2}
}

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

func (fake *QuotaGuard) 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)
}
