// 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 (
	"github.com/absmach/supermq/readers"
	mock "github.com/stretchr/testify/mock"
)

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

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

	return mock
}

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

type MessageRepository_Expecter struct {
	mock *mock.Mock
}

func (_m *MessageRepository) EXPECT() *MessageRepository_Expecter {
	return &MessageRepository_Expecter{mock: &_m.Mock}
}

// ReadAll provides a mock function for the type MessageRepository
func (_mock *MessageRepository) ReadAll(chanID string, pm readers.PageMetadata) (readers.MessagesPage, error) {
	ret := _mock.Called(chanID, pm)

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

	var r0 readers.MessagesPage
	var r1 error
	if returnFunc, ok := ret.Get(0).(func(string, readers.PageMetadata) (readers.MessagesPage, error)); ok {
		return returnFunc(chanID, pm)
	}
	if returnFunc, ok := ret.Get(0).(func(string, readers.PageMetadata) readers.MessagesPage); ok {
		r0 = returnFunc(chanID, pm)
	} else {
		r0 = ret.Get(0).(readers.MessagesPage)
	}
	if returnFunc, ok := ret.Get(1).(func(string, readers.PageMetadata) error); ok {
		r1 = returnFunc(chanID, pm)
	} else {
		r1 = ret.Error(1)
	}
	return r0, r1
}

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

// ReadAll is a helper method to define mock.On call
//   - chanID string
//   - pm readers.PageMetadata
func (_e *MessageRepository_Expecter) ReadAll(chanID interface{}, pm interface{}) *MessageRepository_ReadAll_Call {
	return &MessageRepository_ReadAll_Call{Call: _e.mock.On("ReadAll", chanID, pm)}
}

func (_c *MessageRepository_ReadAll_Call) Run(run func(chanID string, pm readers.PageMetadata)) *MessageRepository_ReadAll_Call {
	_c.Call.Run(func(args mock.Arguments) {
		var arg0 string
		if args[0] != nil {
			arg0 = args[0].(string)
		}
		var arg1 readers.PageMetadata
		if args[1] != nil {
			arg1 = args[1].(readers.PageMetadata)
		}
		run(
			arg0,
			arg1,
		)
	})
	return _c
}

func (_c *MessageRepository_ReadAll_Call) Return(messagesPage readers.MessagesPage, err error) *MessageRepository_ReadAll_Call {
	_c.Call.Return(messagesPage, err)
	return _c
}

func (_c *MessageRepository_ReadAll_Call) RunAndReturn(run func(chanID string, pm readers.PageMetadata) (readers.MessagesPage, error)) *MessageRepository_ReadAll_Call {
	_c.Call.Return(run)
	return _c
}
