// Code generated by pegomock. DO NOT EDIT.
// Source: github.com/runatlantis/atlantis/server/core/locking (interfaces: Locker)

package mocks

import (
	pegomock "github.com/petergtz/pegomock/v4"
	locking "github.com/runatlantis/atlantis/server/core/locking"
	models "github.com/runatlantis/atlantis/server/events/models"
	"reflect"
	"time"
)

type MockLocker struct {
	fail func(message string, callerSkip ...int)
}

func NewMockLocker(options ...pegomock.Option) *MockLocker {
	mock := &MockLocker{}
	for _, option := range options {
		option.Apply(mock)
	}
	return mock
}

func (mock *MockLocker) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockLocker) FailHandler() pegomock.FailHandler      { return mock.fail }

func (mock *MockLocker) GetLock(key string) (*models.ProjectLock, error) {
	if mock == nil {
		panic("mock must not be nil. Use myMock := NewMockLocker().")
	}
	_params := []pegomock.Param{key}
	_result := pegomock.GetGenericMockFrom(mock).Invoke("GetLock", _params, []reflect.Type{reflect.TypeOf((**models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
	var _ret0 *models.ProjectLock
	var _ret1 error
	if len(_result) != 0 {
		if _result[0] != nil {
			_ret0 = _result[0].(*models.ProjectLock)
		}
		if _result[1] != nil {
			_ret1 = _result[1].(error)
		}
	}
	return _ret0, _ret1
}

func (mock *MockLocker) List() (map[string]models.ProjectLock, error) {
	if mock == nil {
		panic("mock must not be nil. Use myMock := NewMockLocker().")
	}
	_params := []pegomock.Param{}
	_result := pegomock.GetGenericMockFrom(mock).Invoke("List", _params, []reflect.Type{reflect.TypeOf((*map[string]models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
	var _ret0 map[string]models.ProjectLock
	var _ret1 error
	if len(_result) != 0 {
		if _result[0] != nil {
			_ret0 = _result[0].(map[string]models.ProjectLock)
		}
		if _result[1] != nil {
			_ret1 = _result[1].(error)
		}
	}
	return _ret0, _ret1
}

func (mock *MockLocker) TryLock(p models.Project, workspace string, pull models.PullRequest, user models.User) (locking.TryLockResponse, error) {
	if mock == nil {
		panic("mock must not be nil. Use myMock := NewMockLocker().")
	}
	_params := []pegomock.Param{p, workspace, pull, user}
	_result := pegomock.GetGenericMockFrom(mock).Invoke("TryLock", _params, []reflect.Type{reflect.TypeOf((*locking.TryLockResponse)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
	var _ret0 locking.TryLockResponse
	var _ret1 error
	if len(_result) != 0 {
		if _result[0] != nil {
			_ret0 = _result[0].(locking.TryLockResponse)
		}
		if _result[1] != nil {
			_ret1 = _result[1].(error)
		}
	}
	return _ret0, _ret1
}

func (mock *MockLocker) Unlock(key string) (*models.ProjectLock, error) {
	if mock == nil {
		panic("mock must not be nil. Use myMock := NewMockLocker().")
	}
	_params := []pegomock.Param{key}
	_result := pegomock.GetGenericMockFrom(mock).Invoke("Unlock", _params, []reflect.Type{reflect.TypeOf((**models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
	var _ret0 *models.ProjectLock
	var _ret1 error
	if len(_result) != 0 {
		if _result[0] != nil {
			_ret0 = _result[0].(*models.ProjectLock)
		}
		if _result[1] != nil {
			_ret1 = _result[1].(error)
		}
	}
	return _ret0, _ret1
}

func (mock *MockLocker) UnlockByPull(repoFullName string, pullNum int) ([]models.ProjectLock, error) {
	if mock == nil {
		panic("mock must not be nil. Use myMock := NewMockLocker().")
	}
	_params := []pegomock.Param{repoFullName, pullNum}
	_result := pegomock.GetGenericMockFrom(mock).Invoke("UnlockByPull", _params, []reflect.Type{reflect.TypeOf((*[]models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
	var _ret0 []models.ProjectLock
	var _ret1 error
	if len(_result) != 0 {
		if _result[0] != nil {
			_ret0 = _result[0].([]models.ProjectLock)
		}
		if _result[1] != nil {
			_ret1 = _result[1].(error)
		}
	}
	return _ret0, _ret1
}

func (mock *MockLocker) VerifyWasCalledOnce() *VerifierMockLocker {
	return &VerifierMockLocker{
		mock:                   mock,
		invocationCountMatcher: pegomock.Times(1),
	}
}

func (mock *MockLocker) VerifyWasCalled(invocationCountMatcher pegomock.InvocationCountMatcher) *VerifierMockLocker {
	return &VerifierMockLocker{
		mock:                   mock,
		invocationCountMatcher: invocationCountMatcher,
	}
}

func (mock *MockLocker) VerifyWasCalledInOrder(invocationCountMatcher pegomock.InvocationCountMatcher, inOrderContext *pegomock.InOrderContext) *VerifierMockLocker {
	return &VerifierMockLocker{
		mock:                   mock,
		invocationCountMatcher: invocationCountMatcher,
		inOrderContext:         inOrderContext,
	}
}

func (mock *MockLocker) VerifyWasCalledEventually(invocationCountMatcher pegomock.InvocationCountMatcher, timeout time.Duration) *VerifierMockLocker {
	return &VerifierMockLocker{
		mock:                   mock,
		invocationCountMatcher: invocationCountMatcher,
		timeout:                timeout,
	}
}

type VerifierMockLocker struct {
	mock                   *MockLocker
	invocationCountMatcher pegomock.InvocationCountMatcher
	inOrderContext         *pegomock.InOrderContext
	timeout                time.Duration
}

func (verifier *VerifierMockLocker) GetLock(key string) *MockLocker_GetLock_OngoingVerification {
	_params := []pegomock.Param{key}
	methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetLock", _params, verifier.timeout)
	return &MockLocker_GetLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}

type MockLocker_GetLock_OngoingVerification struct {
	mock              *MockLocker
	methodInvocations []pegomock.MethodInvocation
}

func (c *MockLocker_GetLock_OngoingVerification) GetCapturedArguments() string {
	key := c.GetAllCapturedArguments()
	return key[len(key)-1]
}

func (c *MockLocker_GetLock_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
	_params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
	if len(_params) > 0 {
		if len(_params) > 0 {
			_param0 = make([]string, len(c.methodInvocations))
			for u, param := range _params[0] {
				_param0[u] = param.(string)
			}
		}
	}
	return
}

func (verifier *VerifierMockLocker) List() *MockLocker_List_OngoingVerification {
	_params := []pegomock.Param{}
	methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "List", _params, verifier.timeout)
	return &MockLocker_List_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}

type MockLocker_List_OngoingVerification struct {
	mock              *MockLocker
	methodInvocations []pegomock.MethodInvocation
}

func (c *MockLocker_List_OngoingVerification) GetCapturedArguments() {
}

func (c *MockLocker_List_OngoingVerification) GetAllCapturedArguments() {
}

func (verifier *VerifierMockLocker) TryLock(p models.Project, workspace string, pull models.PullRequest, user models.User) *MockLocker_TryLock_OngoingVerification {
	_params := []pegomock.Param{p, workspace, pull, user}
	methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "TryLock", _params, verifier.timeout)
	return &MockLocker_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}

type MockLocker_TryLock_OngoingVerification struct {
	mock              *MockLocker
	methodInvocations []pegomock.MethodInvocation
}

func (c *MockLocker_TryLock_OngoingVerification) GetCapturedArguments() (models.Project, string, models.PullRequest, models.User) {
	p, workspace, pull, user := c.GetAllCapturedArguments()
	return p[len(p)-1], workspace[len(workspace)-1], pull[len(pull)-1], user[len(user)-1]
}

func (c *MockLocker_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string, _param2 []models.PullRequest, _param3 []models.User) {
	_params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
	if len(_params) > 0 {
		if len(_params) > 0 {
			_param0 = make([]models.Project, len(c.methodInvocations))
			for u, param := range _params[0] {
				_param0[u] = param.(models.Project)
			}
		}
		if len(_params) > 1 {
			_param1 = make([]string, len(c.methodInvocations))
			for u, param := range _params[1] {
				_param1[u] = param.(string)
			}
		}
		if len(_params) > 2 {
			_param2 = make([]models.PullRequest, len(c.methodInvocations))
			for u, param := range _params[2] {
				_param2[u] = param.(models.PullRequest)
			}
		}
		if len(_params) > 3 {
			_param3 = make([]models.User, len(c.methodInvocations))
			for u, param := range _params[3] {
				_param3[u] = param.(models.User)
			}
		}
	}
	return
}

func (verifier *VerifierMockLocker) Unlock(key string) *MockLocker_Unlock_OngoingVerification {
	_params := []pegomock.Param{key}
	methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Unlock", _params, verifier.timeout)
	return &MockLocker_Unlock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}

type MockLocker_Unlock_OngoingVerification struct {
	mock              *MockLocker
	methodInvocations []pegomock.MethodInvocation
}

func (c *MockLocker_Unlock_OngoingVerification) GetCapturedArguments() string {
	key := c.GetAllCapturedArguments()
	return key[len(key)-1]
}

func (c *MockLocker_Unlock_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
	_params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
	if len(_params) > 0 {
		if len(_params) > 0 {
			_param0 = make([]string, len(c.methodInvocations))
			for u, param := range _params[0] {
				_param0[u] = param.(string)
			}
		}
	}
	return
}

func (verifier *VerifierMockLocker) UnlockByPull(repoFullName string, pullNum int) *MockLocker_UnlockByPull_OngoingVerification {
	_params := []pegomock.Param{repoFullName, pullNum}
	methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UnlockByPull", _params, verifier.timeout)
	return &MockLocker_UnlockByPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}

type MockLocker_UnlockByPull_OngoingVerification struct {
	mock              *MockLocker
	methodInvocations []pegomock.MethodInvocation
}

func (c *MockLocker_UnlockByPull_OngoingVerification) GetCapturedArguments() (string, int) {
	repoFullName, pullNum := c.GetAllCapturedArguments()
	return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1]
}

func (c *MockLocker_UnlockByPull_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) {
	_params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
	if len(_params) > 0 {
		if len(_params) > 0 {
			_param0 = make([]string, len(c.methodInvocations))
			for u, param := range _params[0] {
				_param0[u] = param.(string)
			}
		}
		if len(_params) > 1 {
			_param1 = make([]int, len(c.methodInvocations))
			for u, param := range _params[1] {
				_param1[u] = param.(int)
			}
		}
	}
	return
}
