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

import (
	"context"
	"sync"

	"github.com/ehsaniara/joblet/internal/joblet/auth"
)

type FakeGRPCAuthorization struct {
	AuthorizedStub        func(context.Context, auth.Operation) error
	authorizedMutex       sync.RWMutex
	authorizedArgsForCall []struct {
		arg1 context.Context
		arg2 auth.Operation
	}
	authorizedReturns struct {
		result1 error
	}
	authorizedReturnsOnCall map[int]struct {
		result1 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeGRPCAuthorization) Authorized(arg1 context.Context, arg2 auth.Operation) error {
	fake.authorizedMutex.Lock()
	ret, specificReturn := fake.authorizedReturnsOnCall[len(fake.authorizedArgsForCall)]
	fake.authorizedArgsForCall = append(fake.authorizedArgsForCall, struct {
		arg1 context.Context
		arg2 auth.Operation
	}{arg1, arg2})
	stub := fake.AuthorizedStub
	fakeReturns := fake.authorizedReturns
	fake.recordInvocation("Authorized", []interface{}{arg1, arg2})
	fake.authorizedMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *FakeGRPCAuthorization) AuthorizedCallCount() int {
	fake.authorizedMutex.RLock()
	defer fake.authorizedMutex.RUnlock()
	return len(fake.authorizedArgsForCall)
}

func (fake *FakeGRPCAuthorization) AuthorizedCalls(stub func(context.Context, auth.Operation) error) {
	fake.authorizedMutex.Lock()
	defer fake.authorizedMutex.Unlock()
	fake.AuthorizedStub = stub
}

func (fake *FakeGRPCAuthorization) AuthorizedArgsForCall(i int) (context.Context, auth.Operation) {
	fake.authorizedMutex.RLock()
	defer fake.authorizedMutex.RUnlock()
	argsForCall := fake.authorizedArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *FakeGRPCAuthorization) AuthorizedReturns(result1 error) {
	fake.authorizedMutex.Lock()
	defer fake.authorizedMutex.Unlock()
	fake.AuthorizedStub = nil
	fake.authorizedReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeGRPCAuthorization) AuthorizedReturnsOnCall(i int, result1 error) {
	fake.authorizedMutex.Lock()
	defer fake.authorizedMutex.Unlock()
	fake.AuthorizedStub = nil
	if fake.authorizedReturnsOnCall == nil {
		fake.authorizedReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.authorizedReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

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

func (fake *FakeGRPCAuthorization) 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 _ auth.GRPCAuthorization = new(FakeGRPCAuthorization)
