// Copyright 2023 Northern.tech AS
//
//    Licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
//
//        http://www.apache.org/licenses/LICENSE-2.0
//
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.

// Code generated by mockery v2.53.5. DO NOT EDIT.

package mocks

import (
	context "context"

	nats "github.com/nats-io/nats.go"
	mock "github.com/stretchr/testify/mock"

	stream "github.com/mendersoftware/mender-server/pkg/stream"
)

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

// ChanSubscribe provides a mock function with given fields: _a0, _a1
func (_m *Client) ChanSubscribe(_a0 string, _a1 chan *nats.Msg) (*nats.Subscription, error) {
	ret := _m.Called(_a0, _a1)

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

	var r0 *nats.Subscription
	var r1 error
	if rf, ok := ret.Get(0).(func(string, chan *nats.Msg) (*nats.Subscription, error)); ok {
		return rf(_a0, _a1)
	}
	if rf, ok := ret.Get(0).(func(string, chan *nats.Msg) *nats.Subscription); ok {
		r0 = rf(_a0, _a1)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*nats.Subscription)
		}
	}

	if rf, ok := ret.Get(1).(func(string, chan *nats.Msg) error); ok {
		r1 = rf(_a0, _a1)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}

// Connect provides a mock function with given fields: ctx, srcAddr, dstAddr
func (_m *Client) Connect(ctx context.Context, srcAddr string, dstAddr string) (stream.Conn, error) {
	ret := _m.Called(ctx, srcAddr, dstAddr)

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

	var r0 stream.Conn
	var r1 error
	if rf, ok := ret.Get(0).(func(context.Context, string, string) (stream.Conn, error)); ok {
		return rf(ctx, srcAddr, dstAddr)
	}
	if rf, ok := ret.Get(0).(func(context.Context, string, string) stream.Conn); ok {
		r0 = rf(ctx, srcAddr, dstAddr)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(stream.Conn)
		}
	}

	if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
		r1 = rf(ctx, srcAddr, dstAddr)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}

// Listen provides a mock function with given fields: addr
func (_m *Client) Listen(addr string) (stream.Listener, error) {
	ret := _m.Called(addr)

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

	var r0 stream.Listener
	var r1 error
	if rf, ok := ret.Get(0).(func(string) (stream.Listener, error)); ok {
		return rf(addr)
	}
	if rf, ok := ret.Get(0).(func(string) stream.Listener); ok {
		r0 = rf(addr)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(stream.Listener)
		}
	}

	if rf, ok := ret.Get(1).(func(string) error); ok {
		r1 = rf(addr)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}

// Publish provides a mock function with given fields: _a0, _a1
func (_m *Client) Publish(_a0 string, _a1 []byte) error {
	ret := _m.Called(_a0, _a1)

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

	var r0 error
	if rf, ok := ret.Get(0).(func(string, []byte) error); ok {
		r0 = rf(_a0, _a1)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}

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

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

	return mock
}
