// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq

package fake

import (
	"context"
	"github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/telemetry"
	"go.opentelemetry.io/otel/trace"
	"sigs.k8s.io/controller-runtime/pkg/client"
	"sync"
)

// ISpanHandlerMock is a mock implementation of telemetry.ISpanHandler.
//
//	func TestSomethingThatUsesISpanHandler(t *testing.T) {
//
//		// make and configure a mocked telemetry.ISpanHandler
//		mockedISpanHandler := &ISpanHandlerMock{
//			GetSpanFunc: func(ctx context.Context, tracer telemetry.ITracer, reconcileObject client.Object, phase string, links ...trace.Link) (context.Context, trace.Span, error) {
//				panic("mock out the GetSpan method")
//			},
//			UnbindSpanFunc: func(reconcileObject client.Object, phase string) error {
//				panic("mock out the UnbindSpan method")
//			},
//		}
//
//		// use mockedISpanHandler in code that requires telemetry.ISpanHandler
//		// and then make assertions.
//
//	}
type ISpanHandlerMock struct {
	// GetSpanFunc mocks the GetSpan method.
	GetSpanFunc func(ctx context.Context, tracer telemetry.ITracer, reconcileObject client.Object, phase string, links ...trace.Link) (context.Context, trace.Span, error)

	// UnbindSpanFunc mocks the UnbindSpan method.
	UnbindSpanFunc func(reconcileObject client.Object, phase string) error

	// calls tracks calls to the methods.
	calls struct {
		// GetSpan holds details about calls to the GetSpan method.
		GetSpan []struct {
			// Ctx is the ctx argument value.
			Ctx context.Context
			// Tracer is the tracer argument value.
			Tracer telemetry.ITracer
			// ReconcileObject is the reconcileObject argument value.
			ReconcileObject client.Object
			// Phase is the phase argument value.
			Phase string
			// Links is the links argument value.
			Links []trace.Link
		}
		// UnbindSpan holds details about calls to the UnbindSpan method.
		UnbindSpan []struct {
			// ReconcileObject is the reconcileObject argument value.
			ReconcileObject client.Object
			// Phase is the phase argument value.
			Phase string
		}
	}
	lockGetSpan    sync.RWMutex
	lockUnbindSpan sync.RWMutex
}

// GetSpan calls GetSpanFunc.
func (mock *ISpanHandlerMock) GetSpan(ctx context.Context, tracer telemetry.ITracer, reconcileObject client.Object, phase string, links ...trace.Link) (context.Context, trace.Span, error) {
	if mock.GetSpanFunc == nil {
		panic("ISpanHandlerMock.GetSpanFunc: method is nil but ISpanHandler.GetSpan was just called")
	}
	callInfo := struct {
		Ctx             context.Context
		Tracer          telemetry.ITracer
		ReconcileObject client.Object
		Phase           string
		Links           []trace.Link
	}{
		Ctx:             ctx,
		Tracer:          tracer,
		ReconcileObject: reconcileObject,
		Phase:           phase,
		Links:           links,
	}
	mock.lockGetSpan.Lock()
	mock.calls.GetSpan = append(mock.calls.GetSpan, callInfo)
	mock.lockGetSpan.Unlock()
	return mock.GetSpanFunc(ctx, tracer, reconcileObject, phase, links...)
}

// GetSpanCalls gets all the calls that were made to GetSpan.
// Check the length with:
//
//	len(mockedISpanHandler.GetSpanCalls())
func (mock *ISpanHandlerMock) GetSpanCalls() []struct {
	Ctx             context.Context
	Tracer          telemetry.ITracer
	ReconcileObject client.Object
	Phase           string
	Links           []trace.Link
} {
	var calls []struct {
		Ctx             context.Context
		Tracer          telemetry.ITracer
		ReconcileObject client.Object
		Phase           string
		Links           []trace.Link
	}
	mock.lockGetSpan.RLock()
	calls = mock.calls.GetSpan
	mock.lockGetSpan.RUnlock()
	return calls
}

// UnbindSpan calls UnbindSpanFunc.
func (mock *ISpanHandlerMock) UnbindSpan(reconcileObject client.Object, phase string) error {
	if mock.UnbindSpanFunc == nil {
		panic("ISpanHandlerMock.UnbindSpanFunc: method is nil but ISpanHandler.UnbindSpan was just called")
	}
	callInfo := struct {
		ReconcileObject client.Object
		Phase           string
	}{
		ReconcileObject: reconcileObject,
		Phase:           phase,
	}
	mock.lockUnbindSpan.Lock()
	mock.calls.UnbindSpan = append(mock.calls.UnbindSpan, callInfo)
	mock.lockUnbindSpan.Unlock()
	return mock.UnbindSpanFunc(reconcileObject, phase)
}

// UnbindSpanCalls gets all the calls that were made to UnbindSpan.
// Check the length with:
//
//	len(mockedISpanHandler.UnbindSpanCalls())
func (mock *ISpanHandlerMock) UnbindSpanCalls() []struct {
	ReconcileObject client.Object
	Phase           string
} {
	var calls []struct {
		ReconcileObject client.Object
		Phase           string
	}
	mock.lockUnbindSpan.RLock()
	calls = mock.calls.UnbindSpan
	mock.lockUnbindSpan.RUnlock()
	return calls
}
