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

package corestorage

import (
	"net/http"
	"sync"

	"github.com/balerter/balerter/internal/alert"
)

// AlertMock is a mock implementation of Alert.
//
// 	func TestSomethingThatUsesAlert(t *testing.T) {
//
// 		// make and configure a mocked Alert
// 		mockedAlert := &AlertMock{
// 			GetFunc: func(name string) (*alert.Alert, error) {
// 				panic("mock out the Get method")
// 			},
// 			IndexFunc: func(levels []alert.Level) (alert.Alerts, error) {
// 				panic("mock out the Index method")
// 			},
// 			RunApiHandlerFunc: func(rw http.ResponseWriter, req *http.Request)  {
// 				panic("mock out the RunApiHandler method")
// 			},
// 			UpdateFunc: func(name string, level alert.Level) (*alert.Alert, bool, error) {
// 				panic("mock out the Update method")
// 			},
// 		}
//
// 		// use mockedAlert in code that requires Alert
// 		// and then make assertions.
//
// 	}
type AlertMock struct {
	// GetFunc mocks the Get method.
	GetFunc func(name string) (*alert.Alert, error)

	// IndexFunc mocks the Index method.
	IndexFunc func(levels []alert.Level) (alert.Alerts, error)

	// RunApiHandlerFunc mocks the RunApiHandler method.
	RunApiHandlerFunc func(rw http.ResponseWriter, req *http.Request)

	// UpdateFunc mocks the Update method.
	UpdateFunc func(name string, level alert.Level) (*alert.Alert, bool, error)

	// calls tracks calls to the methods.
	calls struct {
		// Get holds details about calls to the Get method.
		Get []struct {
			// Name is the name argument value.
			Name string
		}
		// Index holds details about calls to the Index method.
		Index []struct {
			// Levels is the levels argument value.
			Levels []alert.Level
		}
		// RunApiHandler holds details about calls to the RunApiHandler method.
		RunApiHandler []struct {
			// Rw is the rw argument value.
			Rw http.ResponseWriter
			// Req is the req argument value.
			Req *http.Request
		}
		// Update holds details about calls to the Update method.
		Update []struct {
			// Name is the name argument value.
			Name string
			// Level is the level argument value.
			Level alert.Level
		}
	}
	lockGet           sync.RWMutex
	lockIndex         sync.RWMutex
	lockRunApiHandler sync.RWMutex
	lockUpdate        sync.RWMutex
}

// Get calls GetFunc.
func (mock *AlertMock) Get(name string) (*alert.Alert, error) {
	if mock.GetFunc == nil {
		panic("AlertMock.GetFunc: method is nil but Alert.Get was just called")
	}
	callInfo := struct {
		Name string
	}{
		Name: name,
	}
	mock.lockGet.Lock()
	mock.calls.Get = append(mock.calls.Get, callInfo)
	mock.lockGet.Unlock()
	return mock.GetFunc(name)
}

// GetCalls gets all the calls that were made to Get.
// Check the length with:
//     len(mockedAlert.GetCalls())
func (mock *AlertMock) GetCalls() []struct {
	Name string
} {
	var calls []struct {
		Name string
	}
	mock.lockGet.RLock()
	calls = mock.calls.Get
	mock.lockGet.RUnlock()
	return calls
}

// Index calls IndexFunc.
func (mock *AlertMock) Index(levels []alert.Level) (alert.Alerts, error) {
	if mock.IndexFunc == nil {
		panic("AlertMock.IndexFunc: method is nil but Alert.Index was just called")
	}
	callInfo := struct {
		Levels []alert.Level
	}{
		Levels: levels,
	}
	mock.lockIndex.Lock()
	mock.calls.Index = append(mock.calls.Index, callInfo)
	mock.lockIndex.Unlock()
	return mock.IndexFunc(levels)
}

// IndexCalls gets all the calls that were made to Index.
// Check the length with:
//     len(mockedAlert.IndexCalls())
func (mock *AlertMock) IndexCalls() []struct {
	Levels []alert.Level
} {
	var calls []struct {
		Levels []alert.Level
	}
	mock.lockIndex.RLock()
	calls = mock.calls.Index
	mock.lockIndex.RUnlock()
	return calls
}

// RunApiHandler calls RunApiHandlerFunc.
func (mock *AlertMock) RunApiHandler(rw http.ResponseWriter, req *http.Request) {
	if mock.RunApiHandlerFunc == nil {
		panic("AlertMock.RunApiHandlerFunc: method is nil but Alert.RunApiHandler was just called")
	}
	callInfo := struct {
		Rw  http.ResponseWriter
		Req *http.Request
	}{
		Rw:  rw,
		Req: req,
	}
	mock.lockRunApiHandler.Lock()
	mock.calls.RunApiHandler = append(mock.calls.RunApiHandler, callInfo)
	mock.lockRunApiHandler.Unlock()
	mock.RunApiHandlerFunc(rw, req)
}

// RunApiHandlerCalls gets all the calls that were made to RunApiHandler.
// Check the length with:
//     len(mockedAlert.RunApiHandlerCalls())
func (mock *AlertMock) RunApiHandlerCalls() []struct {
	Rw  http.ResponseWriter
	Req *http.Request
} {
	var calls []struct {
		Rw  http.ResponseWriter
		Req *http.Request
	}
	mock.lockRunApiHandler.RLock()
	calls = mock.calls.RunApiHandler
	mock.lockRunApiHandler.RUnlock()
	return calls
}

// Update calls UpdateFunc.
func (mock *AlertMock) Update(name string, level alert.Level) (*alert.Alert, bool, error) {
	if mock.UpdateFunc == nil {
		panic("AlertMock.UpdateFunc: method is nil but Alert.Update was just called")
	}
	callInfo := struct {
		Name  string
		Level alert.Level
	}{
		Name:  name,
		Level: level,
	}
	mock.lockUpdate.Lock()
	mock.calls.Update = append(mock.calls.Update, callInfo)
	mock.lockUpdate.Unlock()
	return mock.UpdateFunc(name, level)
}

// UpdateCalls gets all the calls that were made to Update.
// Check the length with:
//     len(mockedAlert.UpdateCalls())
func (mock *AlertMock) UpdateCalls() []struct {
	Name  string
	Level alert.Level
} {
	var calls []struct {
		Name  string
		Level alert.Level
	}
	mock.lockUpdate.RLock()
	calls = mock.calls.Update
	mock.lockUpdate.RUnlock()
	return calls
}
