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

import (
	"sync"

	"code.cloudfoundry.org/policy-server/store"
	"code.cloudfoundry.org/policy-server/uaa_client"
)

type PolicyFilter struct {
	FilterPoliciesStub        func([]store.Policy, uaa_client.CheckTokenResponse) ([]store.Policy, error)
	filterPoliciesMutex       sync.RWMutex
	filterPoliciesArgsForCall []struct {
		arg1 []store.Policy
		arg2 uaa_client.CheckTokenResponse
	}
	filterPoliciesReturns struct {
		result1 []store.Policy
		result2 error
	}
	filterPoliciesReturnsOnCall map[int]struct {
		result1 []store.Policy
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *PolicyFilter) FilterPolicies(arg1 []store.Policy, arg2 uaa_client.CheckTokenResponse) ([]store.Policy, error) {
	var arg1Copy []store.Policy
	if arg1 != nil {
		arg1Copy = make([]store.Policy, len(arg1))
		copy(arg1Copy, arg1)
	}
	fake.filterPoliciesMutex.Lock()
	ret, specificReturn := fake.filterPoliciesReturnsOnCall[len(fake.filterPoliciesArgsForCall)]
	fake.filterPoliciesArgsForCall = append(fake.filterPoliciesArgsForCall, struct {
		arg1 []store.Policy
		arg2 uaa_client.CheckTokenResponse
	}{arg1Copy, arg2})
	stub := fake.FilterPoliciesStub
	fakeReturns := fake.filterPoliciesReturns
	fake.recordInvocation("FilterPolicies", []interface{}{arg1Copy, arg2})
	fake.filterPoliciesMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *PolicyFilter) FilterPoliciesCallCount() int {
	fake.filterPoliciesMutex.RLock()
	defer fake.filterPoliciesMutex.RUnlock()
	return len(fake.filterPoliciesArgsForCall)
}

func (fake *PolicyFilter) FilterPoliciesCalls(stub func([]store.Policy, uaa_client.CheckTokenResponse) ([]store.Policy, error)) {
	fake.filterPoliciesMutex.Lock()
	defer fake.filterPoliciesMutex.Unlock()
	fake.FilterPoliciesStub = stub
}

func (fake *PolicyFilter) FilterPoliciesArgsForCall(i int) ([]store.Policy, uaa_client.CheckTokenResponse) {
	fake.filterPoliciesMutex.RLock()
	defer fake.filterPoliciesMutex.RUnlock()
	argsForCall := fake.filterPoliciesArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *PolicyFilter) FilterPoliciesReturns(result1 []store.Policy, result2 error) {
	fake.filterPoliciesMutex.Lock()
	defer fake.filterPoliciesMutex.Unlock()
	fake.FilterPoliciesStub = nil
	fake.filterPoliciesReturns = struct {
		result1 []store.Policy
		result2 error
	}{result1, result2}
}

func (fake *PolicyFilter) FilterPoliciesReturnsOnCall(i int, result1 []store.Policy, result2 error) {
	fake.filterPoliciesMutex.Lock()
	defer fake.filterPoliciesMutex.Unlock()
	fake.FilterPoliciesStub = nil
	if fake.filterPoliciesReturnsOnCall == nil {
		fake.filterPoliciesReturnsOnCall = make(map[int]struct {
			result1 []store.Policy
			result2 error
		})
	}
	fake.filterPoliciesReturnsOnCall[i] = struct {
		result1 []store.Policy
		result2 error
	}{result1, result2}
}

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

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