// Copyright (c) Abstract Machines

// SPDX-License-Identifier: Apache-2.0

// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify

package mocks

import (
	"context"

	"github.com/absmach/magistrala/auth"
	mock "github.com/stretchr/testify/mock"
)

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

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

	return mock
}

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

type KeyRepository_Expecter struct {
	mock *mock.Mock
}

func (_m *KeyRepository) EXPECT() *KeyRepository_Expecter {
	return &KeyRepository_Expecter{mock: &_m.Mock}
}

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

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

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

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

// Remove is a helper method to define mock.On call
//   - ctx context.Context
//   - issuer string
//   - id string
func (_e *KeyRepository_Expecter) Remove(ctx interface{}, issuer interface{}, id interface{}) *KeyRepository_Remove_Call {
	return &KeyRepository_Remove_Call{Call: _e.mock.On("Remove", ctx, issuer, id)}
}

func (_c *KeyRepository_Remove_Call) Run(run func(ctx context.Context, issuer string, id string)) *KeyRepository_Remove_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 *KeyRepository_Remove_Call) Return(err error) *KeyRepository_Remove_Call {
	_c.Call.Return(err)
	return _c
}

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

// Retrieve provides a mock function for the type KeyRepository
func (_mock *KeyRepository) Retrieve(ctx context.Context, issuer string, id string) (auth.Key, error) {
	ret := _mock.Called(ctx, issuer, id)

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

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

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

// Retrieve is a helper method to define mock.On call
//   - ctx context.Context
//   - issuer string
//   - id string
func (_e *KeyRepository_Expecter) Retrieve(ctx interface{}, issuer interface{}, id interface{}) *KeyRepository_Retrieve_Call {
	return &KeyRepository_Retrieve_Call{Call: _e.mock.On("Retrieve", ctx, issuer, id)}
}

func (_c *KeyRepository_Retrieve_Call) Run(run func(ctx context.Context, issuer string, id string)) *KeyRepository_Retrieve_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 *KeyRepository_Retrieve_Call) Return(key auth.Key, err error) *KeyRepository_Retrieve_Call {
	_c.Call.Return(key, err)
	return _c
}

func (_c *KeyRepository_Retrieve_Call) RunAndReturn(run func(ctx context.Context, issuer string, id string) (auth.Key, error)) *KeyRepository_Retrieve_Call {
	_c.Call.Return(run)
	return _c
}

// Save provides a mock function for the type KeyRepository
func (_mock *KeyRepository) Save(ctx context.Context, key auth.Key) (string, error) {
	ret := _mock.Called(ctx, key)

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

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

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

// Save is a helper method to define mock.On call
//   - ctx context.Context
//   - key auth.Key
func (_e *KeyRepository_Expecter) Save(ctx interface{}, key interface{}) *KeyRepository_Save_Call {
	return &KeyRepository_Save_Call{Call: _e.mock.On("Save", ctx, key)}
}

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

func (_c *KeyRepository_Save_Call) Return(id string, err error) *KeyRepository_Save_Call {
	_c.Call.Return(id, err)
	return _c
}

func (_c *KeyRepository_Save_Call) RunAndReturn(run func(ctx context.Context, key auth.Key) (string, error)) *KeyRepository_Save_Call {
	_c.Call.Return(run)
	return _c
}
