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

package fake

import (
	"k8s.io/apimachinery/pkg/runtime"
	"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
	"sync"
)

// MockDecoder is a mock implementation of handlers.Decoder.
//
//	func TestSomethingThatUsesDecoder(t *testing.T) {
//
//		// make and configure a mocked handlers.Decoder
//		mockedDecoder := &MockDecoder{
//			DecodeFunc: func(req admission.Request, into runtime.Object) error {
//				panic("mock out the Decode method")
//			},
//			DecodeRawFunc: func(rawObj runtime.RawExtension, into runtime.Object) error {
//				panic("mock out the DecodeRaw method")
//			},
//		}
//
//		// use mockedDecoder in code that requires handlers.Decoder
//		// and then make assertions.
//
//	}
type MockDecoder struct {
	// DecodeFunc mocks the Decode method.
	DecodeFunc func(req admission.Request, into runtime.Object) error

	// DecodeRawFunc mocks the DecodeRaw method.
	DecodeRawFunc func(rawObj runtime.RawExtension, into runtime.Object) error

	// calls tracks calls to the methods.
	calls struct {
		// Decode holds details about calls to the Decode method.
		Decode []struct {
			// Req is the req argument value.
			Req admission.Request
			// Into is the into argument value.
			Into runtime.Object
		}
		// DecodeRaw holds details about calls to the DecodeRaw method.
		DecodeRaw []struct {
			// RawObj is the rawObj argument value.
			RawObj runtime.RawExtension
			// Into is the into argument value.
			Into runtime.Object
		}
	}
	lockDecode    sync.RWMutex
	lockDecodeRaw sync.RWMutex
}

// Decode calls DecodeFunc.
func (mock *MockDecoder) Decode(req admission.Request, into runtime.Object) error {
	if mock.DecodeFunc == nil {
		panic("MockDecoder.DecodeFunc: method is nil but Decoder.Decode was just called")
	}
	callInfo := struct {
		Req  admission.Request
		Into runtime.Object
	}{
		Req:  req,
		Into: into,
	}
	mock.lockDecode.Lock()
	mock.calls.Decode = append(mock.calls.Decode, callInfo)
	mock.lockDecode.Unlock()
	return mock.DecodeFunc(req, into)
}

// DecodeCalls gets all the calls that were made to Decode.
// Check the length with:
//
//	len(mockedDecoder.DecodeCalls())
func (mock *MockDecoder) DecodeCalls() []struct {
	Req  admission.Request
	Into runtime.Object
} {
	var calls []struct {
		Req  admission.Request
		Into runtime.Object
	}
	mock.lockDecode.RLock()
	calls = mock.calls.Decode
	mock.lockDecode.RUnlock()
	return calls
}

// DecodeRaw calls DecodeRawFunc.
func (mock *MockDecoder) DecodeRaw(rawObj runtime.RawExtension, into runtime.Object) error {
	if mock.DecodeRawFunc == nil {
		panic("MockDecoder.DecodeRawFunc: method is nil but Decoder.DecodeRaw was just called")
	}
	callInfo := struct {
		RawObj runtime.RawExtension
		Into   runtime.Object
	}{
		RawObj: rawObj,
		Into:   into,
	}
	mock.lockDecodeRaw.Lock()
	mock.calls.DecodeRaw = append(mock.calls.DecodeRaw, callInfo)
	mock.lockDecodeRaw.Unlock()
	return mock.DecodeRawFunc(rawObj, into)
}

// DecodeRawCalls gets all the calls that were made to DecodeRaw.
// Check the length with:
//
//	len(mockedDecoder.DecodeRawCalls())
func (mock *MockDecoder) DecodeRawCalls() []struct {
	RawObj runtime.RawExtension
	Into   runtime.Object
} {
	var calls []struct {
		RawObj runtime.RawExtension
		Into   runtime.Object
	}
	mock.lockDecodeRaw.RLock()
	calls = mock.calls.DecodeRaw
	mock.lockDecodeRaw.RUnlock()
	return calls
}
