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

import (
	"context"
	"sync"

	"code.cloudfoundry.org/korifi/api/authorization"
	"code.cloudfoundry.org/korifi/api/handlers"
	"code.cloudfoundry.org/korifi/api/repositories"
)

type CFRoleRepository struct {
	CreateRoleStub        func(context.Context, authorization.Info, repositories.CreateRoleMessage) (repositories.RoleRecord, error)
	createRoleMutex       sync.RWMutex
	createRoleArgsForCall []struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 repositories.CreateRoleMessage
	}
	createRoleReturns struct {
		result1 repositories.RoleRecord
		result2 error
	}
	createRoleReturnsOnCall map[int]struct {
		result1 repositories.RoleRecord
		result2 error
	}
	DeleteRoleStub        func(context.Context, authorization.Info, repositories.DeleteRoleMessage) error
	deleteRoleMutex       sync.RWMutex
	deleteRoleArgsForCall []struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 repositories.DeleteRoleMessage
	}
	deleteRoleReturns struct {
		result1 error
	}
	deleteRoleReturnsOnCall map[int]struct {
		result1 error
	}
	GetRoleStub        func(context.Context, authorization.Info, string) (repositories.RoleRecord, error)
	getRoleMutex       sync.RWMutex
	getRoleArgsForCall []struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 string
	}
	getRoleReturns struct {
		result1 repositories.RoleRecord
		result2 error
	}
	getRoleReturnsOnCall map[int]struct {
		result1 repositories.RoleRecord
		result2 error
	}
	ListRolesStub        func(context.Context, authorization.Info, repositories.ListRolesMessage) (repositories.ListResult[repositories.RoleRecord], error)
	listRolesMutex       sync.RWMutex
	listRolesArgsForCall []struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 repositories.ListRolesMessage
	}
	listRolesReturns struct {
		result1 repositories.ListResult[repositories.RoleRecord]
		result2 error
	}
	listRolesReturnsOnCall map[int]struct {
		result1 repositories.ListResult[repositories.RoleRecord]
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *CFRoleRepository) CreateRole(arg1 context.Context, arg2 authorization.Info, arg3 repositories.CreateRoleMessage) (repositories.RoleRecord, error) {
	fake.createRoleMutex.Lock()
	ret, specificReturn := fake.createRoleReturnsOnCall[len(fake.createRoleArgsForCall)]
	fake.createRoleArgsForCall = append(fake.createRoleArgsForCall, struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 repositories.CreateRoleMessage
	}{arg1, arg2, arg3})
	stub := fake.CreateRoleStub
	fakeReturns := fake.createRoleReturns
	fake.recordInvocation("CreateRole", []interface{}{arg1, arg2, arg3})
	fake.createRoleMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2, arg3)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *CFRoleRepository) CreateRoleCallCount() int {
	fake.createRoleMutex.RLock()
	defer fake.createRoleMutex.RUnlock()
	return len(fake.createRoleArgsForCall)
}

func (fake *CFRoleRepository) CreateRoleCalls(stub func(context.Context, authorization.Info, repositories.CreateRoleMessage) (repositories.RoleRecord, error)) {
	fake.createRoleMutex.Lock()
	defer fake.createRoleMutex.Unlock()
	fake.CreateRoleStub = stub
}

func (fake *CFRoleRepository) CreateRoleArgsForCall(i int) (context.Context, authorization.Info, repositories.CreateRoleMessage) {
	fake.createRoleMutex.RLock()
	defer fake.createRoleMutex.RUnlock()
	argsForCall := fake.createRoleArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}

func (fake *CFRoleRepository) CreateRoleReturns(result1 repositories.RoleRecord, result2 error) {
	fake.createRoleMutex.Lock()
	defer fake.createRoleMutex.Unlock()
	fake.CreateRoleStub = nil
	fake.createRoleReturns = struct {
		result1 repositories.RoleRecord
		result2 error
	}{result1, result2}
}

func (fake *CFRoleRepository) CreateRoleReturnsOnCall(i int, result1 repositories.RoleRecord, result2 error) {
	fake.createRoleMutex.Lock()
	defer fake.createRoleMutex.Unlock()
	fake.CreateRoleStub = nil
	if fake.createRoleReturnsOnCall == nil {
		fake.createRoleReturnsOnCall = make(map[int]struct {
			result1 repositories.RoleRecord
			result2 error
		})
	}
	fake.createRoleReturnsOnCall[i] = struct {
		result1 repositories.RoleRecord
		result2 error
	}{result1, result2}
}

func (fake *CFRoleRepository) DeleteRole(arg1 context.Context, arg2 authorization.Info, arg3 repositories.DeleteRoleMessage) error {
	fake.deleteRoleMutex.Lock()
	ret, specificReturn := fake.deleteRoleReturnsOnCall[len(fake.deleteRoleArgsForCall)]
	fake.deleteRoleArgsForCall = append(fake.deleteRoleArgsForCall, struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 repositories.DeleteRoleMessage
	}{arg1, arg2, arg3})
	stub := fake.DeleteRoleStub
	fakeReturns := fake.deleteRoleReturns
	fake.recordInvocation("DeleteRole", []interface{}{arg1, arg2, arg3})
	fake.deleteRoleMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2, arg3)
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *CFRoleRepository) DeleteRoleCallCount() int {
	fake.deleteRoleMutex.RLock()
	defer fake.deleteRoleMutex.RUnlock()
	return len(fake.deleteRoleArgsForCall)
}

func (fake *CFRoleRepository) DeleteRoleCalls(stub func(context.Context, authorization.Info, repositories.DeleteRoleMessage) error) {
	fake.deleteRoleMutex.Lock()
	defer fake.deleteRoleMutex.Unlock()
	fake.DeleteRoleStub = stub
}

func (fake *CFRoleRepository) DeleteRoleArgsForCall(i int) (context.Context, authorization.Info, repositories.DeleteRoleMessage) {
	fake.deleteRoleMutex.RLock()
	defer fake.deleteRoleMutex.RUnlock()
	argsForCall := fake.deleteRoleArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}

func (fake *CFRoleRepository) DeleteRoleReturns(result1 error) {
	fake.deleteRoleMutex.Lock()
	defer fake.deleteRoleMutex.Unlock()
	fake.DeleteRoleStub = nil
	fake.deleteRoleReturns = struct {
		result1 error
	}{result1}
}

func (fake *CFRoleRepository) DeleteRoleReturnsOnCall(i int, result1 error) {
	fake.deleteRoleMutex.Lock()
	defer fake.deleteRoleMutex.Unlock()
	fake.DeleteRoleStub = nil
	if fake.deleteRoleReturnsOnCall == nil {
		fake.deleteRoleReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.deleteRoleReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

func (fake *CFRoleRepository) GetRole(arg1 context.Context, arg2 authorization.Info, arg3 string) (repositories.RoleRecord, error) {
	fake.getRoleMutex.Lock()
	ret, specificReturn := fake.getRoleReturnsOnCall[len(fake.getRoleArgsForCall)]
	fake.getRoleArgsForCall = append(fake.getRoleArgsForCall, struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 string
	}{arg1, arg2, arg3})
	stub := fake.GetRoleStub
	fakeReturns := fake.getRoleReturns
	fake.recordInvocation("GetRole", []interface{}{arg1, arg2, arg3})
	fake.getRoleMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2, arg3)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *CFRoleRepository) GetRoleCallCount() int {
	fake.getRoleMutex.RLock()
	defer fake.getRoleMutex.RUnlock()
	return len(fake.getRoleArgsForCall)
}

func (fake *CFRoleRepository) GetRoleCalls(stub func(context.Context, authorization.Info, string) (repositories.RoleRecord, error)) {
	fake.getRoleMutex.Lock()
	defer fake.getRoleMutex.Unlock()
	fake.GetRoleStub = stub
}

func (fake *CFRoleRepository) GetRoleArgsForCall(i int) (context.Context, authorization.Info, string) {
	fake.getRoleMutex.RLock()
	defer fake.getRoleMutex.RUnlock()
	argsForCall := fake.getRoleArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}

func (fake *CFRoleRepository) GetRoleReturns(result1 repositories.RoleRecord, result2 error) {
	fake.getRoleMutex.Lock()
	defer fake.getRoleMutex.Unlock()
	fake.GetRoleStub = nil
	fake.getRoleReturns = struct {
		result1 repositories.RoleRecord
		result2 error
	}{result1, result2}
}

func (fake *CFRoleRepository) GetRoleReturnsOnCall(i int, result1 repositories.RoleRecord, result2 error) {
	fake.getRoleMutex.Lock()
	defer fake.getRoleMutex.Unlock()
	fake.GetRoleStub = nil
	if fake.getRoleReturnsOnCall == nil {
		fake.getRoleReturnsOnCall = make(map[int]struct {
			result1 repositories.RoleRecord
			result2 error
		})
	}
	fake.getRoleReturnsOnCall[i] = struct {
		result1 repositories.RoleRecord
		result2 error
	}{result1, result2}
}

func (fake *CFRoleRepository) ListRoles(arg1 context.Context, arg2 authorization.Info, arg3 repositories.ListRolesMessage) (repositories.ListResult[repositories.RoleRecord], error) {
	fake.listRolesMutex.Lock()
	ret, specificReturn := fake.listRolesReturnsOnCall[len(fake.listRolesArgsForCall)]
	fake.listRolesArgsForCall = append(fake.listRolesArgsForCall, struct {
		arg1 context.Context
		arg2 authorization.Info
		arg3 repositories.ListRolesMessage
	}{arg1, arg2, arg3})
	stub := fake.ListRolesStub
	fakeReturns := fake.listRolesReturns
	fake.recordInvocation("ListRoles", []interface{}{arg1, arg2, arg3})
	fake.listRolesMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2, arg3)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *CFRoleRepository) ListRolesCallCount() int {
	fake.listRolesMutex.RLock()
	defer fake.listRolesMutex.RUnlock()
	return len(fake.listRolesArgsForCall)
}

func (fake *CFRoleRepository) ListRolesCalls(stub func(context.Context, authorization.Info, repositories.ListRolesMessage) (repositories.ListResult[repositories.RoleRecord], error)) {
	fake.listRolesMutex.Lock()
	defer fake.listRolesMutex.Unlock()
	fake.ListRolesStub = stub
}

func (fake *CFRoleRepository) ListRolesArgsForCall(i int) (context.Context, authorization.Info, repositories.ListRolesMessage) {
	fake.listRolesMutex.RLock()
	defer fake.listRolesMutex.RUnlock()
	argsForCall := fake.listRolesArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}

func (fake *CFRoleRepository) ListRolesReturns(result1 repositories.ListResult[repositories.RoleRecord], result2 error) {
	fake.listRolesMutex.Lock()
	defer fake.listRolesMutex.Unlock()
	fake.ListRolesStub = nil
	fake.listRolesReturns = struct {
		result1 repositories.ListResult[repositories.RoleRecord]
		result2 error
	}{result1, result2}
}

func (fake *CFRoleRepository) ListRolesReturnsOnCall(i int, result1 repositories.ListResult[repositories.RoleRecord], result2 error) {
	fake.listRolesMutex.Lock()
	defer fake.listRolesMutex.Unlock()
	fake.ListRolesStub = nil
	if fake.listRolesReturnsOnCall == nil {
		fake.listRolesReturnsOnCall = make(map[int]struct {
			result1 repositories.ListResult[repositories.RoleRecord]
			result2 error
		})
	}
	fake.listRolesReturnsOnCall[i] = struct {
		result1 repositories.ListResult[repositories.RoleRecord]
		result2 error
	}{result1, result2}
}

func (fake *CFRoleRepository) 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 *CFRoleRepository) 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 _ handlers.CFRoleRepository = new(CFRoleRepository)
