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

import (
	"context"
	"sync"

	"github.com/ehsaniara/joblet/internal/joblet/core/execution"
)

type FakeProcessManager struct {
	KillProcessStub        func(int) error
	killProcessMutex       sync.RWMutex
	killProcessArgsForCall []struct {
		arg1 int
	}
	killProcessReturns struct {
		result1 error
	}
	killProcessReturnsOnCall map[int]struct {
		result1 error
	}
	LaunchProcessStub        func(context.Context, *execution.LaunchConfig) (*execution.ProcessResult, error)
	launchProcessMutex       sync.RWMutex
	launchProcessArgsForCall []struct {
		arg1 context.Context
		arg2 *execution.LaunchConfig
	}
	launchProcessReturns struct {
		result1 *execution.ProcessResult
		result2 error
	}
	launchProcessReturnsOnCall map[int]struct {
		result1 *execution.ProcessResult
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeProcessManager) KillProcess(arg1 int) error {
	fake.killProcessMutex.Lock()
	ret, specificReturn := fake.killProcessReturnsOnCall[len(fake.killProcessArgsForCall)]
	fake.killProcessArgsForCall = append(fake.killProcessArgsForCall, struct {
		arg1 int
	}{arg1})
	stub := fake.KillProcessStub
	fakeReturns := fake.killProcessReturns
	fake.recordInvocation("KillProcess", []interface{}{arg1})
	fake.killProcessMutex.Unlock()
	if stub != nil {
		return stub(arg1)
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *FakeProcessManager) KillProcessCallCount() int {
	fake.killProcessMutex.RLock()
	defer fake.killProcessMutex.RUnlock()
	return len(fake.killProcessArgsForCall)
}

func (fake *FakeProcessManager) KillProcessCalls(stub func(int) error) {
	fake.killProcessMutex.Lock()
	defer fake.killProcessMutex.Unlock()
	fake.KillProcessStub = stub
}

func (fake *FakeProcessManager) KillProcessArgsForCall(i int) int {
	fake.killProcessMutex.RLock()
	defer fake.killProcessMutex.RUnlock()
	argsForCall := fake.killProcessArgsForCall[i]
	return argsForCall.arg1
}

func (fake *FakeProcessManager) KillProcessReturns(result1 error) {
	fake.killProcessMutex.Lock()
	defer fake.killProcessMutex.Unlock()
	fake.KillProcessStub = nil
	fake.killProcessReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeProcessManager) KillProcessReturnsOnCall(i int, result1 error) {
	fake.killProcessMutex.Lock()
	defer fake.killProcessMutex.Unlock()
	fake.KillProcessStub = nil
	if fake.killProcessReturnsOnCall == nil {
		fake.killProcessReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.killProcessReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

func (fake *FakeProcessManager) LaunchProcess(arg1 context.Context, arg2 *execution.LaunchConfig) (*execution.ProcessResult, error) {
	fake.launchProcessMutex.Lock()
	ret, specificReturn := fake.launchProcessReturnsOnCall[len(fake.launchProcessArgsForCall)]
	fake.launchProcessArgsForCall = append(fake.launchProcessArgsForCall, struct {
		arg1 context.Context
		arg2 *execution.LaunchConfig
	}{arg1, arg2})
	stub := fake.LaunchProcessStub
	fakeReturns := fake.launchProcessReturns
	fake.recordInvocation("LaunchProcess", []interface{}{arg1, arg2})
	fake.launchProcessMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *FakeProcessManager) LaunchProcessCallCount() int {
	fake.launchProcessMutex.RLock()
	defer fake.launchProcessMutex.RUnlock()
	return len(fake.launchProcessArgsForCall)
}

func (fake *FakeProcessManager) LaunchProcessCalls(stub func(context.Context, *execution.LaunchConfig) (*execution.ProcessResult, error)) {
	fake.launchProcessMutex.Lock()
	defer fake.launchProcessMutex.Unlock()
	fake.LaunchProcessStub = stub
}

func (fake *FakeProcessManager) LaunchProcessArgsForCall(i int) (context.Context, *execution.LaunchConfig) {
	fake.launchProcessMutex.RLock()
	defer fake.launchProcessMutex.RUnlock()
	argsForCall := fake.launchProcessArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *FakeProcessManager) LaunchProcessReturns(result1 *execution.ProcessResult, result2 error) {
	fake.launchProcessMutex.Lock()
	defer fake.launchProcessMutex.Unlock()
	fake.LaunchProcessStub = nil
	fake.launchProcessReturns = struct {
		result1 *execution.ProcessResult
		result2 error
	}{result1, result2}
}

func (fake *FakeProcessManager) LaunchProcessReturnsOnCall(i int, result1 *execution.ProcessResult, result2 error) {
	fake.launchProcessMutex.Lock()
	defer fake.launchProcessMutex.Unlock()
	fake.LaunchProcessStub = nil
	if fake.launchProcessReturnsOnCall == nil {
		fake.launchProcessReturnsOnCall = make(map[int]struct {
			result1 *execution.ProcessResult
			result2 error
		})
	}
	fake.launchProcessReturnsOnCall[i] = struct {
		result1 *execution.ProcessResult
		result2 error
	}{result1, result2}
}

func (fake *FakeProcessManager) 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 *FakeProcessManager) 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 _ execution.ProcessManager = new(FakeProcessManager)
