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

import (
	"context"
	"sync"

	"code.cloudfoundry.org/korifi/api/handlers"
	"code.cloudfoundry.org/korifi/api/handlers/stats"
)

type InstancesStateCollector struct {
	CollectProcessInstancesStatesStub        func(context.Context, string) ([]stats.ProcessInstanceState, error)
	collectProcessInstancesStatesMutex       sync.RWMutex
	collectProcessInstancesStatesArgsForCall []struct {
		arg1 context.Context
		arg2 string
	}
	collectProcessInstancesStatesReturns struct {
		result1 []stats.ProcessInstanceState
		result2 error
	}
	collectProcessInstancesStatesReturnsOnCall map[int]struct {
		result1 []stats.ProcessInstanceState
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *InstancesStateCollector) CollectProcessInstancesStates(arg1 context.Context, arg2 string) ([]stats.ProcessInstanceState, error) {
	fake.collectProcessInstancesStatesMutex.Lock()
	ret, specificReturn := fake.collectProcessInstancesStatesReturnsOnCall[len(fake.collectProcessInstancesStatesArgsForCall)]
	fake.collectProcessInstancesStatesArgsForCall = append(fake.collectProcessInstancesStatesArgsForCall, struct {
		arg1 context.Context
		arg2 string
	}{arg1, arg2})
	stub := fake.CollectProcessInstancesStatesStub
	fakeReturns := fake.collectProcessInstancesStatesReturns
	fake.recordInvocation("CollectProcessInstancesStates", []interface{}{arg1, arg2})
	fake.collectProcessInstancesStatesMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2)
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *InstancesStateCollector) CollectProcessInstancesStatesCallCount() int {
	fake.collectProcessInstancesStatesMutex.RLock()
	defer fake.collectProcessInstancesStatesMutex.RUnlock()
	return len(fake.collectProcessInstancesStatesArgsForCall)
}

func (fake *InstancesStateCollector) CollectProcessInstancesStatesCalls(stub func(context.Context, string) ([]stats.ProcessInstanceState, error)) {
	fake.collectProcessInstancesStatesMutex.Lock()
	defer fake.collectProcessInstancesStatesMutex.Unlock()
	fake.CollectProcessInstancesStatesStub = stub
}

func (fake *InstancesStateCollector) CollectProcessInstancesStatesArgsForCall(i int) (context.Context, string) {
	fake.collectProcessInstancesStatesMutex.RLock()
	defer fake.collectProcessInstancesStatesMutex.RUnlock()
	argsForCall := fake.collectProcessInstancesStatesArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2
}

func (fake *InstancesStateCollector) CollectProcessInstancesStatesReturns(result1 []stats.ProcessInstanceState, result2 error) {
	fake.collectProcessInstancesStatesMutex.Lock()
	defer fake.collectProcessInstancesStatesMutex.Unlock()
	fake.CollectProcessInstancesStatesStub = nil
	fake.collectProcessInstancesStatesReturns = struct {
		result1 []stats.ProcessInstanceState
		result2 error
	}{result1, result2}
}

func (fake *InstancesStateCollector) CollectProcessInstancesStatesReturnsOnCall(i int, result1 []stats.ProcessInstanceState, result2 error) {
	fake.collectProcessInstancesStatesMutex.Lock()
	defer fake.collectProcessInstancesStatesMutex.Unlock()
	fake.CollectProcessInstancesStatesStub = nil
	if fake.collectProcessInstancesStatesReturnsOnCall == nil {
		fake.collectProcessInstancesStatesReturnsOnCall = make(map[int]struct {
			result1 []stats.ProcessInstanceState
			result2 error
		})
	}
	fake.collectProcessInstancesStatesReturnsOnCall[i] = struct {
		result1 []stats.ProcessInstanceState
		result2 error
	}{result1, result2}
}

func (fake *InstancesStateCollector) 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 *InstancesStateCollector) 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 _ handlers.InstancesStateCollector = new(InstancesStateCollector)
