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

import (
	"context"
	"sync"

	"github.com/ehsaniara/joblet/internal/joblet/domain"
	"github.com/ehsaniara/joblet/internal/joblet/scheduler"
)

type FakeJobExecutor struct {
	ExecuteScheduledJobStub        func(context.Context, *domain.Job) error
	executeScheduledJobMutex       sync.RWMutex
	executeScheduledJobArgsForCall []struct {
		arg1 context.Context
		arg2 *domain.Job
	}
	executeScheduledJobReturns struct {
		result1 error
	}
	executeScheduledJobReturnsOnCall map[int]struct {
		result1 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeJobExecutor) ExecuteScheduledJob(arg1 context.Context, arg2 *domain.Job) error {
	fake.executeScheduledJobMutex.Lock()
	ret, specificReturn := fake.executeScheduledJobReturnsOnCall[len(fake.executeScheduledJobArgsForCall)]
	fake.executeScheduledJobArgsForCall = append(fake.executeScheduledJobArgsForCall, struct {
		arg1 context.Context
		arg2 *domain.Job
	}{arg1, arg2})
	stub := fake.ExecuteScheduledJobStub
	fakeReturns := fake.executeScheduledJobReturns
	fake.recordInvocation("ExecuteScheduledJob", []interface{}{arg1, arg2})
	fake.executeScheduledJobMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *FakeJobExecutor) ExecuteScheduledJobCallCount() int {
	fake.executeScheduledJobMutex.RLock()
	defer fake.executeScheduledJobMutex.RUnlock()
	return len(fake.executeScheduledJobArgsForCall)
}

func (fake *FakeJobExecutor) ExecuteScheduledJobCalls(stub func(context.Context, *domain.Job) error) {
	fake.executeScheduledJobMutex.Lock()
	defer fake.executeScheduledJobMutex.Unlock()
	fake.ExecuteScheduledJobStub = stub
}

func (fake *FakeJobExecutor) ExecuteScheduledJobArgsForCall(i int) (context.Context, *domain.Job) {
	fake.executeScheduledJobMutex.RLock()
	defer fake.executeScheduledJobMutex.RUnlock()
	argsForCall := fake.executeScheduledJobArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *FakeJobExecutor) ExecuteScheduledJobReturns(result1 error) {
	fake.executeScheduledJobMutex.Lock()
	defer fake.executeScheduledJobMutex.Unlock()
	fake.ExecuteScheduledJobStub = nil
	fake.executeScheduledJobReturns = struct {
		result1 error
	}{result1}
}

func (fake *FakeJobExecutor) ExecuteScheduledJobReturnsOnCall(i int, result1 error) {
	fake.executeScheduledJobMutex.Lock()
	defer fake.executeScheduledJobMutex.Unlock()
	fake.ExecuteScheduledJobStub = nil
	if fake.executeScheduledJobReturnsOnCall == nil {
		fake.executeScheduledJobReturnsOnCall = make(map[int]struct {
			result1 error
		})
	}
	fake.executeScheduledJobReturnsOnCall[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 _ scheduler.JobExecutor = new(FakeJobExecutor)
