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

import (
	"sync"

	"code.cloudfoundry.org/diego-ssh/handlers"
	"code.cloudfoundry.org/diego-ssh/helpers"
	"code.cloudfoundry.org/lager/v3"
	"golang.org/x/crypto/ssh"
)

type FakeGlobalRequestHandler struct {
	HandleRequestStub        func(lager.Logger, *ssh.Request, ssh.Conn, *helpers.ListenerStore)
	handleRequestMutex       sync.RWMutex
	handleRequestArgsForCall []struct {
		arg1 lager.Logger
		arg2 *ssh.Request
		arg3 ssh.Conn
		arg4 *helpers.ListenerStore
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeGlobalRequestHandler) HandleRequest(arg1 lager.Logger, arg2 *ssh.Request, arg3 ssh.Conn, arg4 *helpers.ListenerStore) {
	fake.handleRequestMutex.Lock()
	fake.handleRequestArgsForCall = append(fake.handleRequestArgsForCall, struct {
		arg1 lager.Logger
		arg2 *ssh.Request
		arg3 ssh.Conn
		arg4 *helpers.ListenerStore
	}{arg1, arg2, arg3, arg4})
	fake.recordInvocation("HandleRequest", []interface{}{arg1, arg2, arg3, arg4})
	handleRequestStubCopy := fake.HandleRequestStub
	fake.handleRequestMutex.Unlock()
	if handleRequestStubCopy != nil {
		handleRequestStubCopy(arg1, arg2, arg3, arg4)
	}
}

func (fake *FakeGlobalRequestHandler) HandleRequestCallCount() int {
	fake.handleRequestMutex.RLock()
	defer fake.handleRequestMutex.RUnlock()
	return len(fake.handleRequestArgsForCall)
}

func (fake *FakeGlobalRequestHandler) HandleRequestCalls(stub func(lager.Logger, *ssh.Request, ssh.Conn, *helpers.ListenerStore)) {
	fake.handleRequestMutex.Lock()
	defer fake.handleRequestMutex.Unlock()
	fake.HandleRequestStub = stub
}

func (fake *FakeGlobalRequestHandler) HandleRequestArgsForCall(i int) (lager.Logger, *ssh.Request, ssh.Conn, *helpers.ListenerStore) {
	fake.handleRequestMutex.RLock()
	defer fake.handleRequestMutex.RUnlock()
	argsForCall := fake.handleRequestArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
}

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

func (fake *FakeGlobalRequestHandler) 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.GlobalRequestHandler = new(FakeGlobalRequestHandler)
