// 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"

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

// NewPubSub creates a new instance of PubSub. 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 NewPubSub(t interface {
	mock.TestingT
	Cleanup(func())
}) *PubSub {
	mock := &PubSub{}
	mock.Mock.Test(t)

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

	return mock
}

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

type PubSub_Expecter struct {
	mock *mock.Mock
}

func (_m *PubSub) EXPECT() *PubSub_Expecter {
	return &PubSub_Expecter{mock: &_m.Mock}
}

// Close provides a mock function for the type PubSub
func (_mock *PubSub) Close() error {
	ret := _mock.Called()

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

	var r0 error
	if returnFunc, ok := ret.Get(0).(func() error); ok {
		r0 = returnFunc()
	} else {
		r0 = ret.Error(0)
	}
	return r0
}

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

// Close is a helper method to define mock.On call
func (_e *PubSub_Expecter) Close() *PubSub_Close_Call {
	return &PubSub_Close_Call{Call: _e.mock.On("Close")}
}

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

func (_c *PubSub_Close_Call) Return(err error) *PubSub_Close_Call {
	_c.Call.Return(err)
	return _c
}

func (_c *PubSub_Close_Call) RunAndReturn(run func() error) *PubSub_Close_Call {
	_c.Call.Return(run)
	return _c
}

// Publish provides a mock function for the type PubSub
func (_mock *PubSub) Publish(ctx context.Context, topic string, msg *messaging.Message) error {
	ret := _mock.Called(ctx, topic, msg)

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

	var r0 error
	if returnFunc, ok := ret.Get(0).(func(context.Context, string, *messaging.Message) error); ok {
		r0 = returnFunc(ctx, topic, msg)
	} else {
		r0 = ret.Error(0)
	}
	return r0
}

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

// Publish is a helper method to define mock.On call
//   - ctx context.Context
//   - topic string
//   - msg *messaging.Message
func (_e *PubSub_Expecter) Publish(ctx interface{}, topic interface{}, msg interface{}) *PubSub_Publish_Call {
	return &PubSub_Publish_Call{Call: _e.mock.On("Publish", ctx, topic, msg)}
}

func (_c *PubSub_Publish_Call) Run(run func(ctx context.Context, topic string, msg *messaging.Message)) *PubSub_Publish_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)
		}
		var arg2 *messaging.Message
		if args[2] != nil {
			arg2 = args[2].(*messaging.Message)
		}
		run(
			arg0,
			arg1,
			arg2,
		)
	})
	return _c
}

func (_c *PubSub_Publish_Call) Return(err error) *PubSub_Publish_Call {
	_c.Call.Return(err)
	return _c
}

func (_c *PubSub_Publish_Call) RunAndReturn(run func(ctx context.Context, topic string, msg *messaging.Message) error) *PubSub_Publish_Call {
	_c.Call.Return(run)
	return _c
}

// Subscribe provides a mock function for the type PubSub
func (_mock *PubSub) Subscribe(ctx context.Context, cfg messaging.SubscriberConfig) error {
	ret := _mock.Called(ctx, cfg)

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

	var r0 error
	if returnFunc, ok := ret.Get(0).(func(context.Context, messaging.SubscriberConfig) error); ok {
		r0 = returnFunc(ctx, cfg)
	} else {
		r0 = ret.Error(0)
	}
	return r0
}

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

// Subscribe is a helper method to define mock.On call
//   - ctx context.Context
//   - cfg messaging.SubscriberConfig
func (_e *PubSub_Expecter) Subscribe(ctx interface{}, cfg interface{}) *PubSub_Subscribe_Call {
	return &PubSub_Subscribe_Call{Call: _e.mock.On("Subscribe", ctx, cfg)}
}

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

func (_c *PubSub_Subscribe_Call) Return(err error) *PubSub_Subscribe_Call {
	_c.Call.Return(err)
	return _c
}

func (_c *PubSub_Subscribe_Call) RunAndReturn(run func(ctx context.Context, cfg messaging.SubscriberConfig) error) *PubSub_Subscribe_Call {
	_c.Call.Return(run)
	return _c
}

// Unsubscribe provides a mock function for the type PubSub
func (_mock *PubSub) Unsubscribe(ctx context.Context, id string, topic string) error {
	ret := _mock.Called(ctx, id, topic)

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

	var r0 error
	if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) error); ok {
		r0 = returnFunc(ctx, id, topic)
	} else {
		r0 = ret.Error(0)
	}
	return r0
}

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

// Unsubscribe is a helper method to define mock.On call
//   - ctx context.Context
//   - id string
//   - topic string
func (_e *PubSub_Expecter) Unsubscribe(ctx interface{}, id interface{}, topic interface{}) *PubSub_Unsubscribe_Call {
	return &PubSub_Unsubscribe_Call{Call: _e.mock.On("Unsubscribe", ctx, id, topic)}
}

func (_c *PubSub_Unsubscribe_Call) Run(run func(ctx context.Context, id string, topic string)) *PubSub_Unsubscribe_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)
		}
		var arg2 string
		if args[2] != nil {
			arg2 = args[2].(string)
		}
		run(
			arg0,
			arg1,
			arg2,
		)
	})
	return _c
}

func (_c *PubSub_Unsubscribe_Call) Return(err error) *PubSub_Unsubscribe_Call {
	_c.Call.Return(err)
	return _c
}

func (_c *PubSub_Unsubscribe_Call) RunAndReturn(run func(ctx context.Context, id string, topic string) error) *PubSub_Unsubscribe_Call {
	_c.Call.Return(run)
	return _c
}
