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

import (
	"sync"

	"code.cloudfoundry.org/diego-ssh/authenticators"
	"golang.org/x/crypto/ssh"
)

type FakePublicKeyAuthenticator struct {
	AuthenticateStub        func(ssh.ConnMetadata, ssh.PublicKey) (*ssh.Permissions, error)
	authenticateMutex       sync.RWMutex
	authenticateArgsForCall []struct {
		arg1 ssh.ConnMetadata
		arg2 ssh.PublicKey
	}
	authenticateReturns struct {
		result1 *ssh.Permissions
		result2 error
	}
	authenticateReturnsOnCall map[int]struct {
		result1 *ssh.Permissions
		result2 error
	}
	PublicKeyStub        func() ssh.PublicKey
	publicKeyMutex       sync.RWMutex
	publicKeyArgsForCall []struct {
	}
	publicKeyReturns struct {
		result1 ssh.PublicKey
	}
	publicKeyReturnsOnCall map[int]struct {
		result1 ssh.PublicKey
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakePublicKeyAuthenticator) Authenticate(arg1 ssh.ConnMetadata, arg2 ssh.PublicKey) (*ssh.Permissions, error) {
	fake.authenticateMutex.Lock()
	ret, specificReturn := fake.authenticateReturnsOnCall[len(fake.authenticateArgsForCall)]
	fake.authenticateArgsForCall = append(fake.authenticateArgsForCall, struct {
		arg1 ssh.ConnMetadata
		arg2 ssh.PublicKey
	}{arg1, arg2})
	fake.recordInvocation("Authenticate", []interface{}{arg1, arg2})
	authenticateStubCopy := fake.AuthenticateStub
	fake.authenticateMutex.Unlock()
	if authenticateStubCopy != nil {
		return authenticateStubCopy(arg1, arg2)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	fakeReturns := fake.authenticateReturns
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *FakePublicKeyAuthenticator) AuthenticateCallCount() int {
	fake.authenticateMutex.RLock()
	defer fake.authenticateMutex.RUnlock()
	return len(fake.authenticateArgsForCall)
}

func (fake *FakePublicKeyAuthenticator) AuthenticateCalls(stub func(ssh.ConnMetadata, ssh.PublicKey) (*ssh.Permissions, error)) {
	fake.authenticateMutex.Lock()
	defer fake.authenticateMutex.Unlock()
	fake.AuthenticateStub = stub
}

func (fake *FakePublicKeyAuthenticator) AuthenticateArgsForCall(i int) (ssh.ConnMetadata, ssh.PublicKey) {
	fake.authenticateMutex.RLock()
	defer fake.authenticateMutex.RUnlock()
	argsForCall := fake.authenticateArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *FakePublicKeyAuthenticator) AuthenticateReturns(result1 *ssh.Permissions, result2 error) {
	fake.authenticateMutex.Lock()
	defer fake.authenticateMutex.Unlock()
	fake.AuthenticateStub = nil
	fake.authenticateReturns = struct {
		result1 *ssh.Permissions
		result2 error
	}{result1, result2}
}

func (fake *FakePublicKeyAuthenticator) AuthenticateReturnsOnCall(i int, result1 *ssh.Permissions, result2 error) {
	fake.authenticateMutex.Lock()
	defer fake.authenticateMutex.Unlock()
	fake.AuthenticateStub = nil
	if fake.authenticateReturnsOnCall == nil {
		fake.authenticateReturnsOnCall = make(map[int]struct {
			result1 *ssh.Permissions
			result2 error
		})
	}
	fake.authenticateReturnsOnCall[i] = struct {
		result1 *ssh.Permissions
		result2 error
	}{result1, result2}
}

func (fake *FakePublicKeyAuthenticator) PublicKey() ssh.PublicKey {
	fake.publicKeyMutex.Lock()
	ret, specificReturn := fake.publicKeyReturnsOnCall[len(fake.publicKeyArgsForCall)]
	fake.publicKeyArgsForCall = append(fake.publicKeyArgsForCall, struct {
	}{})
	fake.recordInvocation("PublicKey", []interface{}{})
	publicKeyStubCopy := fake.PublicKeyStub
	fake.publicKeyMutex.Unlock()
	if publicKeyStubCopy != nil {
		return publicKeyStubCopy()
	}
	if specificReturn {
		return ret.result1
	}
	fakeReturns := fake.publicKeyReturns
	return fakeReturns.result1
}

func (fake *FakePublicKeyAuthenticator) PublicKeyCallCount() int {
	fake.publicKeyMutex.RLock()
	defer fake.publicKeyMutex.RUnlock()
	return len(fake.publicKeyArgsForCall)
}

func (fake *FakePublicKeyAuthenticator) PublicKeyCalls(stub func() ssh.PublicKey) {
	fake.publicKeyMutex.Lock()
	defer fake.publicKeyMutex.Unlock()
	fake.PublicKeyStub = stub
}

func (fake *FakePublicKeyAuthenticator) PublicKeyReturns(result1 ssh.PublicKey) {
	fake.publicKeyMutex.Lock()
	defer fake.publicKeyMutex.Unlock()
	fake.PublicKeyStub = nil
	fake.publicKeyReturns = struct {
		result1 ssh.PublicKey
	}{result1}
}

func (fake *FakePublicKeyAuthenticator) PublicKeyReturnsOnCall(i int, result1 ssh.PublicKey) {
	fake.publicKeyMutex.Lock()
	defer fake.publicKeyMutex.Unlock()
	fake.PublicKeyStub = nil
	if fake.publicKeyReturnsOnCall == nil {
		fake.publicKeyReturnsOnCall = make(map[int]struct {
			result1 ssh.PublicKey
		})
	}
	fake.publicKeyReturnsOnCall[i] = struct {
		result1 ssh.PublicKey
	}{result1}
}

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

func (fake *FakePublicKeyAuthenticator) 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 _ authenticators.PublicKeyAuthenticator = new(FakePublicKeyAuthenticator)
