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

import (
	"context"
	"sync"

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

type FakeJobExecutor struct {
	StartJobStub        func(context.Context, *execution.StartProcessOptions) (platform.Command, error)
	startJobMutex       sync.RWMutex
	startJobArgsForCall []struct {
		arg1 context.Context
		arg2 *execution.StartProcessOptions
	}
	startJobReturns struct {
		result1 platform.Command
		result2 error
	}
	startJobReturnsOnCall map[int]struct {
		result1 platform.Command
		result2 error
	}
	StopJobStub        func(context.Context, string) error
	stopJobMutex       sync.RWMutex
	stopJobArgsForCall []struct {
		arg1 context.Context
		arg2 string
	}
	stopJobReturns struct {
		result1 error
	}
	stopJobReturnsOnCall map[int]struct {
		result1 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeJobExecutor) StartJob(arg1 context.Context, arg2 *execution.StartProcessOptions) (platform.Command, error) {
	fake.startJobMutex.Lock()
	ret, specificReturn := fake.startJobReturnsOnCall[len(fake.startJobArgsForCall)]
	fake.startJobArgsForCall = append(fake.startJobArgsForCall, struct {
		arg1 context.Context
		arg2 *execution.StartProcessOptions
	}{arg1, arg2})
	stub := fake.StartJobStub
	fakeReturns := fake.startJobReturns
	fake.recordInvocation("StartJob", []interface{}{arg1, arg2})
	fake.startJobMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *FakeJobExecutor) StartJobCallCount() int {
	fake.startJobMutex.RLock()
	defer fake.startJobMutex.RUnlock()
	return len(fake.startJobArgsForCall)
}

func (fake *FakeJobExecutor) StartJobCalls(stub func(context.Context, *execution.StartProcessOptions) (platform.Command, error)) {
	fake.startJobMutex.Lock()
	defer fake.startJobMutex.Unlock()
	fake.StartJobStub = stub
}

func (fake *FakeJobExecutor) StartJobArgsForCall(i int) (context.Context, *execution.StartProcessOptions) {
	fake.startJobMutex.RLock()
	defer fake.startJobMutex.RUnlock()
	argsForCall := fake.startJobArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *FakeJobExecutor) StartJobReturns(result1 platform.Command, result2 error) {
	fake.startJobMutex.Lock()
	defer fake.startJobMutex.Unlock()
	fake.StartJobStub = nil
	fake.startJobReturns = struct {
		result1 platform.Command
		result2 error
	}{result1, result2}
}

func (fake *FakeJobExecutor) StartJobReturnsOnCall(i int, result1 platform.Command, result2 error) {
	fake.startJobMutex.Lock()
	defer fake.startJobMutex.Unlock()
	fake.StartJobStub = nil
	if fake.startJobReturnsOnCall == nil {
		fake.startJobReturnsOnCall = make(map[int]struct {
			result1 platform.Command
			result2 error
		})
	}
	fake.startJobReturnsOnCall[i] = struct {
		result1 platform.Command
		result2 error
	}{result1, result2}
}

func (fake *FakeJobExecutor) StopJob(arg1 context.Context, arg2 string) error {
	fake.stopJobMutex.Lock()
	ret, specificReturn := fake.stopJobReturnsOnCall[len(fake.stopJobArgsForCall)]
	fake.stopJobArgsForCall = append(fake.stopJobArgsForCall, struct {
		arg1 context.Context
		arg2 string
	}{arg1, arg2})
	stub := fake.StopJobStub
	fakeReturns := fake.stopJobReturns
	fake.recordInvocation("StopJob", []interface{}{arg1, arg2})
	fake.stopJobMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *FakeJobExecutor) StopJobCallCount() int {
	fake.stopJobMutex.RLock()
	defer fake.stopJobMutex.RUnlock()
	return len(fake.stopJobArgsForCall)
}

func (fake *FakeJobExecutor) StopJobCalls(stub func(context.Context, string) error) {
	fake.stopJobMutex.Lock()
	defer fake.stopJobMutex.Unlock()
	fake.StopJobStub = stub
}

func (fake *FakeJobExecutor) StopJobArgsForCall(i int) (context.Context, string) {
	fake.stopJobMutex.RLock()
	defer fake.stopJobMutex.RUnlock()
	argsForCall := fake.stopJobArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *FakeJobExecutor) StopJobReturns(result1 error) {
	fake.stopJobMutex.Lock()
	defer fake.stopJobMutex.Unlock()
	fake.StopJobStub = nil
	fake.stopJobReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeJobExecutor) StopJobReturnsOnCall(i int, result1 error) {
	fake.stopJobMutex.Lock()
	defer fake.stopJobMutex.Unlock()
	fake.StopJobStub = nil
	if fake.stopJobReturnsOnCall == nil {
		fake.stopJobReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.stopJobReturnsOnCall[i] = struct {
		result1 error
	}{result1}
}

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