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

	log "github.com/mendersoftware/mender-server/pkg/log"
	mock "github.com/stretchr/testify/mock"

	model "github.com/mendersoftware/mender-server/services/workflows/model"
)

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

// GetAllJobs provides a mock function with given fields: ctx, page, perPage
func (_m *DataStore) GetAllJobs(ctx context.Context, page int64, perPage int64) ([]model.Job, int64, error) {
	ret := _m.Called(ctx, page, perPage)

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

	var r0 []model.Job
	var r1 int64
	var r2 error
	if rf, ok := ret.Get(0).(func(context.Context, int64, int64) ([]model.Job, int64, error)); ok {
		return rf(ctx, page, perPage)
	}
	if rf, ok := ret.Get(0).(func(context.Context, int64, int64) []model.Job); ok {
		r0 = rf(ctx, page, perPage)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]model.Job)
		}
	}

	if rf, ok := ret.Get(1).(func(context.Context, int64, int64) int64); ok {
		r1 = rf(ctx, page, perPage)
	} else {
		r1 = ret.Get(1).(int64)
	}

	if rf, ok := ret.Get(2).(func(context.Context, int64, int64) error); ok {
		r2 = rf(ctx, page, perPage)
	} else {
		r2 = ret.Error(2)
	}

	return r0, r1, r2
}

// GetJobByID provides a mock function with given fields: ctx, ID
func (_m *DataStore) GetJobByID(ctx context.Context, ID string) (*model.Job, error) {
	ret := _m.Called(ctx, ID)

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

	var r0 *model.Job
	var r1 error
	if rf, ok := ret.Get(0).(func(context.Context, string) (*model.Job, error)); ok {
		return rf(ctx, ID)
	}
	if rf, ok := ret.Get(0).(func(context.Context, string) *model.Job); ok {
		r0 = rf(ctx, ID)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*model.Job)
		}
	}

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

	return r0, r1
}

// GetWorkflowByName provides a mock function with given fields: ctx, workflowName, version
func (_m *DataStore) GetWorkflowByName(ctx context.Context, workflowName string, version string) (*model.Workflow, error) {
	ret := _m.Called(ctx, workflowName, version)

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

	var r0 *model.Workflow
	var r1 error
	if rf, ok := ret.Get(0).(func(context.Context, string, string) (*model.Workflow, error)); ok {
		return rf(ctx, workflowName, version)
	}
	if rf, ok := ret.Get(0).(func(context.Context, string, string) *model.Workflow); ok {
		r0 = rf(ctx, workflowName, version)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*model.Workflow)
		}
	}

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

	return r0, r1
}

// GetWorkflows provides a mock function with given fields: ctx
func (_m *DataStore) GetWorkflows(ctx context.Context) []model.Workflow {
	ret := _m.Called(ctx)

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

	var r0 []model.Workflow
	if rf, ok := ret.Get(0).(func(context.Context) []model.Workflow); ok {
		r0 = rf(ctx)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]model.Workflow)
		}
	}

	return r0
}

// InsertWorkflows provides a mock function with given fields: ctx, workflow
func (_m *DataStore) InsertWorkflows(ctx context.Context, workflow ...model.Workflow) (int, error) {
	_va := make([]interface{}, len(workflow))
	for _i := range workflow {
		_va[_i] = workflow[_i]
	}
	var _ca []interface{}
	_ca = append(_ca, ctx)
	_ca = append(_ca, _va...)
	ret := _m.Called(_ca...)

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

	var r0 int
	var r1 error
	if rf, ok := ret.Get(0).(func(context.Context, ...model.Workflow) (int, error)); ok {
		return rf(ctx, workflow...)
	}
	if rf, ok := ret.Get(0).(func(context.Context, ...model.Workflow) int); ok {
		r0 = rf(ctx, workflow...)
	} else {
		r0 = ret.Get(0).(int)
	}

	if rf, ok := ret.Get(1).(func(context.Context, ...model.Workflow) error); ok {
		r1 = rf(ctx, workflow...)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}

// LoadWorkflows provides a mock function with given fields: ctx, l
func (_m *DataStore) LoadWorkflows(ctx context.Context, l *log.Logger) error {
	ret := _m.Called(ctx, l)

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

	var r0 error
	if rf, ok := ret.Get(0).(func(context.Context, *log.Logger) error); ok {
		r0 = rf(ctx, l)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}

// Ping provides a mock function with given fields: ctx
func (_m *DataStore) Ping(ctx context.Context) error {
	ret := _m.Called(ctx)

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

	var r0 error
	if rf, ok := ret.Get(0).(func(context.Context) error); ok {
		r0 = rf(ctx)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}

// UpdateJobAddResult provides a mock function with given fields: ctx, job, result
func (_m *DataStore) UpdateJobAddResult(ctx context.Context, job *model.Job, result *model.TaskResult) error {
	ret := _m.Called(ctx, job, result)

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

	var r0 error
	if rf, ok := ret.Get(0).(func(context.Context, *model.Job, *model.TaskResult) error); ok {
		r0 = rf(ctx, job, result)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}

// UpdateJobStatus provides a mock function with given fields: ctx, job, status
func (_m *DataStore) UpdateJobStatus(ctx context.Context, job *model.Job, status int32) error {
	ret := _m.Called(ctx, job, status)

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

	var r0 error
	if rf, ok := ret.Get(0).(func(context.Context, *model.Job, int32) error); ok {
		r0 = rf(ctx, job, status)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}

// UpsertJob provides a mock function with given fields: ctx, job
func (_m *DataStore) UpsertJob(ctx context.Context, job *model.Job) (*model.Job, error) {
	ret := _m.Called(ctx, job)

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

	var r0 *model.Job
	var r1 error
	if rf, ok := ret.Get(0).(func(context.Context, *model.Job) (*model.Job, error)); ok {
		return rf(ctx, job)
	}
	if rf, ok := ret.Get(0).(func(context.Context, *model.Job) *model.Job); ok {
		r0 = rf(ctx, job)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*model.Job)
		}
	}

	if rf, ok := ret.Get(1).(func(context.Context, *model.Job) error); ok {
		r1 = rf(ctx, job)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}

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

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

	return mock
}
