// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
// Copyright (c) Abstract Machines

// SPDX-License-Identifier: Apache-2.0

package mocks

import (
	"context"
	"net/http"

	"github.com/absmach/supermq/pkg/authn"
	mock "github.com/stretchr/testify/mock"
)

// NewAuthNMiddleware creates a new instance of AuthNMiddleware. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewAuthNMiddleware(t interface {
	mock.TestingT
	Cleanup(func())
}) *AuthNMiddleware {
	mock := &AuthNMiddleware{}
	mock.Mock.Test(t)

	t.Cleanup(func() { mock.AssertExpectations(t) })

	return mock
}

// AuthNMiddleware is an autogenerated mock type for the AuthNMiddleware type
type AuthNMiddleware struct {
	mock.Mock
}

type AuthNMiddleware_Expecter struct {
	mock *mock.Mock
}

func (_m *AuthNMiddleware) EXPECT() *AuthNMiddleware_Expecter {
	return &AuthNMiddleware_Expecter{mock: &_m.Mock}
}

// Authenticate provides a mock function for the type AuthNMiddleware
func (_mock *AuthNMiddleware) Authenticate(ctx context.Context, token string) (authn.Session, error) {
	ret := _mock.Called(ctx, token)

	if len(ret) == 0 {
		panic("no return value specified for Authenticate")
	}

	var r0 authn.Session
	var r1 error
	if returnFunc, ok := ret.Get(0).(func(context.Context, string) (authn.Session, error)); ok {
		return returnFunc(ctx, token)
	}
	if returnFunc, ok := ret.Get(0).(func(context.Context, string) authn.Session); ok {
		r0 = returnFunc(ctx, token)
	} else {
		r0 = ret.Get(0).(authn.Session)
	}
	if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
		r1 = returnFunc(ctx, token)
	} else {
		r1 = ret.Error(1)
	}
	return r0, r1
}

// AuthNMiddleware_Authenticate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Authenticate'
type AuthNMiddleware_Authenticate_Call struct {
	*mock.Call
}

// Authenticate is a helper method to define mock.On call
//   - ctx context.Context
//   - token string
func (_e *AuthNMiddleware_Expecter) Authenticate(ctx interface{}, token interface{}) *AuthNMiddleware_Authenticate_Call {
	return &AuthNMiddleware_Authenticate_Call{Call: _e.mock.On("Authenticate", ctx, token)}
}

func (_c *AuthNMiddleware_Authenticate_Call) Run(run func(ctx context.Context, token string)) *AuthNMiddleware_Authenticate_Call {
	_c.Call.Run(func(args mock.Arguments) {
		var arg0 context.Context
		if args[0] != nil {
			arg0 = args[0].(context.Context)
		}
		var arg1 string
		if args[1] != nil {
			arg1 = args[1].(string)
		}
		run(
			arg0,
			arg1,
		)
	})
	return _c
}

func (_c *AuthNMiddleware_Authenticate_Call) Return(session authn.Session, err error) *AuthNMiddleware_Authenticate_Call {
	_c.Call.Return(session, err)
	return _c
}

func (_c *AuthNMiddleware_Authenticate_Call) RunAndReturn(run func(ctx context.Context, token string) (authn.Session, error)) *AuthNMiddleware_Authenticate_Call {
	_c.Call.Return(run)
	return _c
}

// Middleware provides a mock function for the type AuthNMiddleware
func (_mock *AuthNMiddleware) Middleware() func(http.Handler) http.Handler {
	ret := _mock.Called()

	if len(ret) == 0 {
		panic("no return value specified for Middleware")
	}

	var r0 func(http.Handler) http.Handler
	if returnFunc, ok := ret.Get(0).(func() func(http.Handler) http.Handler); ok {
		r0 = returnFunc()
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(func(http.Handler) http.Handler)
		}
	}
	return r0
}

// AuthNMiddleware_Middleware_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Middleware'
type AuthNMiddleware_Middleware_Call struct {
	*mock.Call
}

// Middleware is a helper method to define mock.On call
func (_e *AuthNMiddleware_Expecter) Middleware() *AuthNMiddleware_Middleware_Call {
	return &AuthNMiddleware_Middleware_Call{Call: _e.mock.On("Middleware")}
}

func (_c *AuthNMiddleware_Middleware_Call) Run(run func()) *AuthNMiddleware_Middleware_Call {
	_c.Call.Run(func(args mock.Arguments) {
		run()
	})
	return _c
}

func (_c *AuthNMiddleware_Middleware_Call) Return(fn func(http.Handler) http.Handler) *AuthNMiddleware_Middleware_Call {
	_c.Call.Return(fn)
	return _c
}

func (_c *AuthNMiddleware_Middleware_Call) RunAndReturn(run func() func(http.Handler) http.Handler) *AuthNMiddleware_Middleware_Call {
	_c.Call.Return(run)
	return _c
}

// WithOptions provides a mock function for the type AuthNMiddleware
func (_mock *AuthNMiddleware) WithOptions(options ...authn.MiddlewareOption) authn.AuthNMiddleware {
	var tmpRet mock.Arguments
	if len(options) > 0 {
		tmpRet = _mock.Called(options)
	} else {
		tmpRet = _mock.Called()
	}
	ret := tmpRet

	if len(ret) == 0 {
		panic("no return value specified for WithOptions")
	}

	var r0 authn.AuthNMiddleware
	if returnFunc, ok := ret.Get(0).(func(...authn.MiddlewareOption) authn.AuthNMiddleware); ok {
		r0 = returnFunc(options...)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(authn.AuthNMiddleware)
		}
	}
	return r0
}

// AuthNMiddleware_WithOptions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithOptions'
type AuthNMiddleware_WithOptions_Call struct {
	*mock.Call
}

// WithOptions is a helper method to define mock.On call
//   - options ...authn.MiddlewareOption
func (_e *AuthNMiddleware_Expecter) WithOptions(options ...interface{}) *AuthNMiddleware_WithOptions_Call {
	return &AuthNMiddleware_WithOptions_Call{Call: _e.mock.On("WithOptions",
		append([]interface{}{}, options...)...)}
}

func (_c *AuthNMiddleware_WithOptions_Call) Run(run func(options ...authn.MiddlewareOption)) *AuthNMiddleware_WithOptions_Call {
	_c.Call.Run(func(args mock.Arguments) {
		var arg0 []authn.MiddlewareOption
		var variadicArgs []authn.MiddlewareOption
		if len(args) > 0 {
			variadicArgs = args[0].([]authn.MiddlewareOption)
		}
		arg0 = variadicArgs
		run(
			arg0...,
		)
	})
	return _c
}

func (_c *AuthNMiddleware_WithOptions_Call) Return(authNMiddleware authn.AuthNMiddleware) *AuthNMiddleware_WithOptions_Call {
	_c.Call.Return(authNMiddleware)
	return _c
}

func (_c *AuthNMiddleware_WithOptions_Call) RunAndReturn(run func(options ...authn.MiddlewareOption) authn.AuthNMiddleware) *AuthNMiddleware_WithOptions_Call {
	_c.Call.Return(run)
	return _c
}
