package mocks

// Code generated by http://github.com/gojuno/minimock (dev). DO NOT EDIT.

//go:generate minimock -i git.dmitriygnatenko.ru/dima/homethings/internal/interfaces.ThingImageRepository -o ./mocks/thing_image_repository_minimock.go -n ThingImageRepositoryMock

import (
	"context"
	"database/sql"
	"sync"
	mm_atomic "sync/atomic"
	mm_time "time"

	"git.dmitriygnatenko.ru/dima/homethings/internal/models"
	"github.com/gojuno/minimock/v3"
)

// ThingImageRepositoryMock implements interfaces.ThingImageRepository
type ThingImageRepositoryMock struct {
	t minimock.Tester

	funcAdd          func(ctx context.Context, req models.AddThingImageRequest, tx *sql.Tx) (err error)
	inspectFuncAdd   func(ctx context.Context, req models.AddThingImageRequest, tx *sql.Tx)
	afterAddCounter  uint64
	beforeAddCounter uint64
	AddMock          mThingImageRepositoryMockAdd

	funcBeginTx          func(ctx context.Context, level sql.IsolationLevel) (tp1 *sql.Tx, err error)
	inspectFuncBeginTx   func(ctx context.Context, level sql.IsolationLevel)
	afterBeginTxCounter  uint64
	beforeBeginTxCounter uint64
	BeginTxMock          mThingImageRepositoryMockBeginTx

	funcCommitTx          func(tx *sql.Tx) (err error)
	inspectFuncCommitTx   func(tx *sql.Tx)
	afterCommitTxCounter  uint64
	beforeCommitTxCounter uint64
	CommitTxMock          mThingImageRepositoryMockCommitTx

	funcDelete          func(ctx context.Context, imageID int, tx *sql.Tx) (err error)
	inspectFuncDelete   func(ctx context.Context, imageID int, tx *sql.Tx)
	afterDeleteCounter  uint64
	beforeDeleteCounter uint64
	DeleteMock          mThingImageRepositoryMockDelete

	funcGet          func(ctx context.Context, imageID int) (ip1 *models.Image, err error)
	inspectFuncGet   func(ctx context.Context, imageID int)
	afterGetCounter  uint64
	beforeGetCounter uint64
	GetMock          mThingImageRepositoryMockGet

	funcGetByPlaceID          func(ctx context.Context, placeID int) (ia1 []models.Image, err error)
	inspectFuncGetByPlaceID   func(ctx context.Context, placeID int)
	afterGetByPlaceIDCounter  uint64
	beforeGetByPlaceIDCounter uint64
	GetByPlaceIDMock          mThingImageRepositoryMockGetByPlaceID

	funcGetByThingID          func(ctx context.Context, thingID int) (ia1 []models.Image, err error)
	inspectFuncGetByThingID   func(ctx context.Context, thingID int)
	afterGetByThingIDCounter  uint64
	beforeGetByThingIDCounter uint64
	GetByThingIDMock          mThingImageRepositoryMockGetByThingID
}

// NewThingImageRepositoryMock returns a mock for interfaces.ThingImageRepository
func NewThingImageRepositoryMock(t minimock.Tester) *ThingImageRepositoryMock {
	m := &ThingImageRepositoryMock{t: t}
	if controller, ok := t.(minimock.MockController); ok {
		controller.RegisterMocker(m)
	}

	m.AddMock = mThingImageRepositoryMockAdd{mock: m}
	m.AddMock.callArgs = []*ThingImageRepositoryMockAddParams{}

	m.BeginTxMock = mThingImageRepositoryMockBeginTx{mock: m}
	m.BeginTxMock.callArgs = []*ThingImageRepositoryMockBeginTxParams{}

	m.CommitTxMock = mThingImageRepositoryMockCommitTx{mock: m}
	m.CommitTxMock.callArgs = []*ThingImageRepositoryMockCommitTxParams{}

	m.DeleteMock = mThingImageRepositoryMockDelete{mock: m}
	m.DeleteMock.callArgs = []*ThingImageRepositoryMockDeleteParams{}

	m.GetMock = mThingImageRepositoryMockGet{mock: m}
	m.GetMock.callArgs = []*ThingImageRepositoryMockGetParams{}

	m.GetByPlaceIDMock = mThingImageRepositoryMockGetByPlaceID{mock: m}
	m.GetByPlaceIDMock.callArgs = []*ThingImageRepositoryMockGetByPlaceIDParams{}

	m.GetByThingIDMock = mThingImageRepositoryMockGetByThingID{mock: m}
	m.GetByThingIDMock.callArgs = []*ThingImageRepositoryMockGetByThingIDParams{}

	return m
}

type mThingImageRepositoryMockAdd struct {
	mock               *ThingImageRepositoryMock
	defaultExpectation *ThingImageRepositoryMockAddExpectation
	expectations       []*ThingImageRepositoryMockAddExpectation

	callArgs []*ThingImageRepositoryMockAddParams
	mutex    sync.RWMutex
}

// ThingImageRepositoryMockAddExpectation specifies expectation struct of the ThingImageRepository.Add
type ThingImageRepositoryMockAddExpectation struct {
	mock    *ThingImageRepositoryMock
	params  *ThingImageRepositoryMockAddParams
	results *ThingImageRepositoryMockAddResults
	Counter uint64
}

// ThingImageRepositoryMockAddParams contains parameters of the ThingImageRepository.Add
type ThingImageRepositoryMockAddParams struct {
	ctx context.Context
	req models.AddThingImageRequest
	tx  *sql.Tx
}

// ThingImageRepositoryMockAddResults contains results of the ThingImageRepository.Add
type ThingImageRepositoryMockAddResults struct {
	err error
}

// Expect sets up expected params for ThingImageRepository.Add
func (mmAdd *mThingImageRepositoryMockAdd) Expect(ctx context.Context, req models.AddThingImageRequest, tx *sql.Tx) *mThingImageRepositoryMockAdd {
	if mmAdd.mock.funcAdd != nil {
		mmAdd.mock.t.Fatalf("ThingImageRepositoryMock.Add mock is already set by Set")
	}

	if mmAdd.defaultExpectation == nil {
		mmAdd.defaultExpectation = &ThingImageRepositoryMockAddExpectation{}
	}

	mmAdd.defaultExpectation.params = &ThingImageRepositoryMockAddParams{ctx, req, tx}
	for _, e := range mmAdd.expectations {
		if minimock.Equal(e.params, mmAdd.defaultExpectation.params) {
			mmAdd.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmAdd.defaultExpectation.params)
		}
	}

	return mmAdd
}

// Inspect accepts an inspector function that has same arguments as the ThingImageRepository.Add
func (mmAdd *mThingImageRepositoryMockAdd) Inspect(f func(ctx context.Context, req models.AddThingImageRequest, tx *sql.Tx)) *mThingImageRepositoryMockAdd {
	if mmAdd.mock.inspectFuncAdd != nil {
		mmAdd.mock.t.Fatalf("Inspect function is already set for ThingImageRepositoryMock.Add")
	}

	mmAdd.mock.inspectFuncAdd = f

	return mmAdd
}

// Return sets up results that will be returned by ThingImageRepository.Add
func (mmAdd *mThingImageRepositoryMockAdd) Return(err error) *ThingImageRepositoryMock {
	if mmAdd.mock.funcAdd != nil {
		mmAdd.mock.t.Fatalf("ThingImageRepositoryMock.Add mock is already set by Set")
	}

	if mmAdd.defaultExpectation == nil {
		mmAdd.defaultExpectation = &ThingImageRepositoryMockAddExpectation{mock: mmAdd.mock}
	}
	mmAdd.defaultExpectation.results = &ThingImageRepositoryMockAddResults{err}
	return mmAdd.mock
}

// Set uses given function f to mock the ThingImageRepository.Add method
func (mmAdd *mThingImageRepositoryMockAdd) Set(f func(ctx context.Context, req models.AddThingImageRequest, tx *sql.Tx) (err error)) *ThingImageRepositoryMock {
	if mmAdd.defaultExpectation != nil {
		mmAdd.mock.t.Fatalf("Default expectation is already set for the ThingImageRepository.Add method")
	}

	if len(mmAdd.expectations) > 0 {
		mmAdd.mock.t.Fatalf("Some expectations are already set for the ThingImageRepository.Add method")
	}

	mmAdd.mock.funcAdd = f
	return mmAdd.mock
}

// When sets expectation for the ThingImageRepository.Add which will trigger the result defined by the following
// Then helper
func (mmAdd *mThingImageRepositoryMockAdd) When(ctx context.Context, req models.AddThingImageRequest, tx *sql.Tx) *ThingImageRepositoryMockAddExpectation {
	if mmAdd.mock.funcAdd != nil {
		mmAdd.mock.t.Fatalf("ThingImageRepositoryMock.Add mock is already set by Set")
	}

	expectation := &ThingImageRepositoryMockAddExpectation{
		mock:   mmAdd.mock,
		params: &ThingImageRepositoryMockAddParams{ctx, req, tx},
	}
	mmAdd.expectations = append(mmAdd.expectations, expectation)
	return expectation
}

// Then sets up ThingImageRepository.Add return parameters for the expectation previously defined by the When method
func (e *ThingImageRepositoryMockAddExpectation) Then(err error) *ThingImageRepositoryMock {
	e.results = &ThingImageRepositoryMockAddResults{err}
	return e.mock
}

// Add implements interfaces.ThingImageRepository
func (mmAdd *ThingImageRepositoryMock) Add(ctx context.Context, req models.AddThingImageRequest, tx *sql.Tx) (err error) {
	mm_atomic.AddUint64(&mmAdd.beforeAddCounter, 1)
	defer mm_atomic.AddUint64(&mmAdd.afterAddCounter, 1)

	if mmAdd.inspectFuncAdd != nil {
		mmAdd.inspectFuncAdd(ctx, req, tx)
	}

	mm_params := &ThingImageRepositoryMockAddParams{ctx, req, tx}

	// Record call args
	mmAdd.AddMock.mutex.Lock()
	mmAdd.AddMock.callArgs = append(mmAdd.AddMock.callArgs, mm_params)
	mmAdd.AddMock.mutex.Unlock()

	for _, e := range mmAdd.AddMock.expectations {
		if minimock.Equal(e.params, mm_params) {
			mm_atomic.AddUint64(&e.Counter, 1)
			return e.results.err
		}
	}

	if mmAdd.AddMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmAdd.AddMock.defaultExpectation.Counter, 1)
		mm_want := mmAdd.AddMock.defaultExpectation.params
		mm_got := ThingImageRepositoryMockAddParams{ctx, req, tx}
		if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmAdd.t.Errorf("ThingImageRepositoryMock.Add got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmAdd.AddMock.defaultExpectation.results
		if mm_results == nil {
			mmAdd.t.Fatal("No results are set for the ThingImageRepositoryMock.Add")
		}
		return (*mm_results).err
	}
	if mmAdd.funcAdd != nil {
		return mmAdd.funcAdd(ctx, req, tx)
	}
	mmAdd.t.Fatalf("Unexpected call to ThingImageRepositoryMock.Add. %v %v %v", ctx, req, tx)
	return
}

// AddAfterCounter returns a count of finished ThingImageRepositoryMock.Add invocations
func (mmAdd *ThingImageRepositoryMock) AddAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmAdd.afterAddCounter)
}

// AddBeforeCounter returns a count of ThingImageRepositoryMock.Add invocations
func (mmAdd *ThingImageRepositoryMock) AddBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmAdd.beforeAddCounter)
}

// Calls returns a list of arguments used in each call to ThingImageRepositoryMock.Add.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmAdd *mThingImageRepositoryMockAdd) Calls() []*ThingImageRepositoryMockAddParams {
	mmAdd.mutex.RLock()

	argCopy := make([]*ThingImageRepositoryMockAddParams, len(mmAdd.callArgs))
	copy(argCopy, mmAdd.callArgs)

	mmAdd.mutex.RUnlock()

	return argCopy
}

// MinimockAddDone returns true if the count of the Add invocations corresponds
// the number of defined expectations
func (m *ThingImageRepositoryMock) MinimockAddDone() bool {
	for _, e := range m.AddMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.AddMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
		return false
	}
	// if func was set then invocations count should be greater than zero
	if m.funcAdd != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
		return false
	}
	return true
}

// MinimockAddInspect logs each unmet expectation
func (m *ThingImageRepositoryMock) MinimockAddInspect() {
	for _, e := range m.AddMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			m.t.Errorf("Expected call to ThingImageRepositoryMock.Add with params: %#v", *e.params)
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.AddMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
		if m.AddMock.defaultExpectation.params == nil {
			m.t.Error("Expected call to ThingImageRepositoryMock.Add")
		} else {
			m.t.Errorf("Expected call to ThingImageRepositoryMock.Add with params: %#v", *m.AddMock.defaultExpectation.params)
		}
	}
	// if func was set then invocations count should be greater than zero
	if m.funcAdd != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
		m.t.Error("Expected call to ThingImageRepositoryMock.Add")
	}
}

type mThingImageRepositoryMockBeginTx struct {
	mock               *ThingImageRepositoryMock
	defaultExpectation *ThingImageRepositoryMockBeginTxExpectation
	expectations       []*ThingImageRepositoryMockBeginTxExpectation

	callArgs []*ThingImageRepositoryMockBeginTxParams
	mutex    sync.RWMutex
}

// ThingImageRepositoryMockBeginTxExpectation specifies expectation struct of the ThingImageRepository.BeginTx
type ThingImageRepositoryMockBeginTxExpectation struct {
	mock    *ThingImageRepositoryMock
	params  *ThingImageRepositoryMockBeginTxParams
	results *ThingImageRepositoryMockBeginTxResults
	Counter uint64
}

// ThingImageRepositoryMockBeginTxParams contains parameters of the ThingImageRepository.BeginTx
type ThingImageRepositoryMockBeginTxParams struct {
	ctx   context.Context
	level sql.IsolationLevel
}

// ThingImageRepositoryMockBeginTxResults contains results of the ThingImageRepository.BeginTx
type ThingImageRepositoryMockBeginTxResults struct {
	tp1 *sql.Tx
	err error
}

// Expect sets up expected params for ThingImageRepository.BeginTx
func (mmBeginTx *mThingImageRepositoryMockBeginTx) Expect(ctx context.Context, level sql.IsolationLevel) *mThingImageRepositoryMockBeginTx {
	if mmBeginTx.mock.funcBeginTx != nil {
		mmBeginTx.mock.t.Fatalf("ThingImageRepositoryMock.BeginTx mock is already set by Set")
	}

	if mmBeginTx.defaultExpectation == nil {
		mmBeginTx.defaultExpectation = &ThingImageRepositoryMockBeginTxExpectation{}
	}

	mmBeginTx.defaultExpectation.params = &ThingImageRepositoryMockBeginTxParams{ctx, level}
	for _, e := range mmBeginTx.expectations {
		if minimock.Equal(e.params, mmBeginTx.defaultExpectation.params) {
			mmBeginTx.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmBeginTx.defaultExpectation.params)
		}
	}

	return mmBeginTx
}

// Inspect accepts an inspector function that has same arguments as the ThingImageRepository.BeginTx
func (mmBeginTx *mThingImageRepositoryMockBeginTx) Inspect(f func(ctx context.Context, level sql.IsolationLevel)) *mThingImageRepositoryMockBeginTx {
	if mmBeginTx.mock.inspectFuncBeginTx != nil {
		mmBeginTx.mock.t.Fatalf("Inspect function is already set for ThingImageRepositoryMock.BeginTx")
	}

	mmBeginTx.mock.inspectFuncBeginTx = f

	return mmBeginTx
}

// Return sets up results that will be returned by ThingImageRepository.BeginTx
func (mmBeginTx *mThingImageRepositoryMockBeginTx) Return(tp1 *sql.Tx, err error) *ThingImageRepositoryMock {
	if mmBeginTx.mock.funcBeginTx != nil {
		mmBeginTx.mock.t.Fatalf("ThingImageRepositoryMock.BeginTx mock is already set by Set")
	}

	if mmBeginTx.defaultExpectation == nil {
		mmBeginTx.defaultExpectation = &ThingImageRepositoryMockBeginTxExpectation{mock: mmBeginTx.mock}
	}
	mmBeginTx.defaultExpectation.results = &ThingImageRepositoryMockBeginTxResults{tp1, err}
	return mmBeginTx.mock
}

// Set uses given function f to mock the ThingImageRepository.BeginTx method
func (mmBeginTx *mThingImageRepositoryMockBeginTx) Set(f func(ctx context.Context, level sql.IsolationLevel) (tp1 *sql.Tx, err error)) *ThingImageRepositoryMock {
	if mmBeginTx.defaultExpectation != nil {
		mmBeginTx.mock.t.Fatalf("Default expectation is already set for the ThingImageRepository.BeginTx method")
	}

	if len(mmBeginTx.expectations) > 0 {
		mmBeginTx.mock.t.Fatalf("Some expectations are already set for the ThingImageRepository.BeginTx method")
	}

	mmBeginTx.mock.funcBeginTx = f
	return mmBeginTx.mock
}

// When sets expectation for the ThingImageRepository.BeginTx which will trigger the result defined by the following
// Then helper
func (mmBeginTx *mThingImageRepositoryMockBeginTx) When(ctx context.Context, level sql.IsolationLevel) *ThingImageRepositoryMockBeginTxExpectation {
	if mmBeginTx.mock.funcBeginTx != nil {
		mmBeginTx.mock.t.Fatalf("ThingImageRepositoryMock.BeginTx mock is already set by Set")
	}

	expectation := &ThingImageRepositoryMockBeginTxExpectation{
		mock:   mmBeginTx.mock,
		params: &ThingImageRepositoryMockBeginTxParams{ctx, level},
	}
	mmBeginTx.expectations = append(mmBeginTx.expectations, expectation)
	return expectation
}

// Then sets up ThingImageRepository.BeginTx return parameters for the expectation previously defined by the When method
func (e *ThingImageRepositoryMockBeginTxExpectation) Then(tp1 *sql.Tx, err error) *ThingImageRepositoryMock {
	e.results = &ThingImageRepositoryMockBeginTxResults{tp1, err}
	return e.mock
}

// BeginTx implements interfaces.ThingImageRepository
func (mmBeginTx *ThingImageRepositoryMock) BeginTx(ctx context.Context, level sql.IsolationLevel) (tp1 *sql.Tx, err error) {
	mm_atomic.AddUint64(&mmBeginTx.beforeBeginTxCounter, 1)
	defer mm_atomic.AddUint64(&mmBeginTx.afterBeginTxCounter, 1)

	if mmBeginTx.inspectFuncBeginTx != nil {
		mmBeginTx.inspectFuncBeginTx(ctx, level)
	}

	mm_params := &ThingImageRepositoryMockBeginTxParams{ctx, level}

	// Record call args
	mmBeginTx.BeginTxMock.mutex.Lock()
	mmBeginTx.BeginTxMock.callArgs = append(mmBeginTx.BeginTxMock.callArgs, mm_params)
	mmBeginTx.BeginTxMock.mutex.Unlock()

	for _, e := range mmBeginTx.BeginTxMock.expectations {
		if minimock.Equal(e.params, mm_params) {
			mm_atomic.AddUint64(&e.Counter, 1)
			return e.results.tp1, e.results.err
		}
	}

	if mmBeginTx.BeginTxMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmBeginTx.BeginTxMock.defaultExpectation.Counter, 1)
		mm_want := mmBeginTx.BeginTxMock.defaultExpectation.params
		mm_got := ThingImageRepositoryMockBeginTxParams{ctx, level}
		if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmBeginTx.t.Errorf("ThingImageRepositoryMock.BeginTx got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmBeginTx.BeginTxMock.defaultExpectation.results
		if mm_results == nil {
			mmBeginTx.t.Fatal("No results are set for the ThingImageRepositoryMock.BeginTx")
		}
		return (*mm_results).tp1, (*mm_results).err
	}
	if mmBeginTx.funcBeginTx != nil {
		return mmBeginTx.funcBeginTx(ctx, level)
	}
	mmBeginTx.t.Fatalf("Unexpected call to ThingImageRepositoryMock.BeginTx. %v %v", ctx, level)
	return
}

// BeginTxAfterCounter returns a count of finished ThingImageRepositoryMock.BeginTx invocations
func (mmBeginTx *ThingImageRepositoryMock) BeginTxAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmBeginTx.afterBeginTxCounter)
}

// BeginTxBeforeCounter returns a count of ThingImageRepositoryMock.BeginTx invocations
func (mmBeginTx *ThingImageRepositoryMock) BeginTxBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmBeginTx.beforeBeginTxCounter)
}

// Calls returns a list of arguments used in each call to ThingImageRepositoryMock.BeginTx.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmBeginTx *mThingImageRepositoryMockBeginTx) Calls() []*ThingImageRepositoryMockBeginTxParams {
	mmBeginTx.mutex.RLock()

	argCopy := make([]*ThingImageRepositoryMockBeginTxParams, len(mmBeginTx.callArgs))
	copy(argCopy, mmBeginTx.callArgs)

	mmBeginTx.mutex.RUnlock()

	return argCopy
}

// MinimockBeginTxDone returns true if the count of the BeginTx invocations corresponds
// the number of defined expectations
func (m *ThingImageRepositoryMock) MinimockBeginTxDone() bool {
	for _, e := range m.BeginTxMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.BeginTxMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterBeginTxCounter) < 1 {
		return false
	}
	// if func was set then invocations count should be greater than zero
	if m.funcBeginTx != nil && mm_atomic.LoadUint64(&m.afterBeginTxCounter) < 1 {
		return false
	}
	return true
}

// MinimockBeginTxInspect logs each unmet expectation
func (m *ThingImageRepositoryMock) MinimockBeginTxInspect() {
	for _, e := range m.BeginTxMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			m.t.Errorf("Expected call to ThingImageRepositoryMock.BeginTx with params: %#v", *e.params)
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.BeginTxMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterBeginTxCounter) < 1 {
		if m.BeginTxMock.defaultExpectation.params == nil {
			m.t.Error("Expected call to ThingImageRepositoryMock.BeginTx")
		} else {
			m.t.Errorf("Expected call to ThingImageRepositoryMock.BeginTx with params: %#v", *m.BeginTxMock.defaultExpectation.params)
		}
	}
	// if func was set then invocations count should be greater than zero
	if m.funcBeginTx != nil && mm_atomic.LoadUint64(&m.afterBeginTxCounter) < 1 {
		m.t.Error("Expected call to ThingImageRepositoryMock.BeginTx")
	}
}

type mThingImageRepositoryMockCommitTx struct {
	mock               *ThingImageRepositoryMock
	defaultExpectation *ThingImageRepositoryMockCommitTxExpectation
	expectations       []*ThingImageRepositoryMockCommitTxExpectation

	callArgs []*ThingImageRepositoryMockCommitTxParams
	mutex    sync.RWMutex
}

// ThingImageRepositoryMockCommitTxExpectation specifies expectation struct of the ThingImageRepository.CommitTx
type ThingImageRepositoryMockCommitTxExpectation struct {
	mock    *ThingImageRepositoryMock
	params  *ThingImageRepositoryMockCommitTxParams
	results *ThingImageRepositoryMockCommitTxResults
	Counter uint64
}

// ThingImageRepositoryMockCommitTxParams contains parameters of the ThingImageRepository.CommitTx
type ThingImageRepositoryMockCommitTxParams struct {
	tx *sql.Tx
}

// ThingImageRepositoryMockCommitTxResults contains results of the ThingImageRepository.CommitTx
type ThingImageRepositoryMockCommitTxResults struct {
	err error
}

// Expect sets up expected params for ThingImageRepository.CommitTx
func (mmCommitTx *mThingImageRepositoryMockCommitTx) Expect(tx *sql.Tx) *mThingImageRepositoryMockCommitTx {
	if mmCommitTx.mock.funcCommitTx != nil {
		mmCommitTx.mock.t.Fatalf("ThingImageRepositoryMock.CommitTx mock is already set by Set")
	}

	if mmCommitTx.defaultExpectation == nil {
		mmCommitTx.defaultExpectation = &ThingImageRepositoryMockCommitTxExpectation{}
	}

	mmCommitTx.defaultExpectation.params = &ThingImageRepositoryMockCommitTxParams{tx}
	for _, e := range mmCommitTx.expectations {
		if minimock.Equal(e.params, mmCommitTx.defaultExpectation.params) {
			mmCommitTx.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmCommitTx.defaultExpectation.params)
		}
	}

	return mmCommitTx
}

// Inspect accepts an inspector function that has same arguments as the ThingImageRepository.CommitTx
func (mmCommitTx *mThingImageRepositoryMockCommitTx) Inspect(f func(tx *sql.Tx)) *mThingImageRepositoryMockCommitTx {
	if mmCommitTx.mock.inspectFuncCommitTx != nil {
		mmCommitTx.mock.t.Fatalf("Inspect function is already set for ThingImageRepositoryMock.CommitTx")
	}

	mmCommitTx.mock.inspectFuncCommitTx = f

	return mmCommitTx
}

// Return sets up results that will be returned by ThingImageRepository.CommitTx
func (mmCommitTx *mThingImageRepositoryMockCommitTx) Return(err error) *ThingImageRepositoryMock {
	if mmCommitTx.mock.funcCommitTx != nil {
		mmCommitTx.mock.t.Fatalf("ThingImageRepositoryMock.CommitTx mock is already set by Set")
	}

	if mmCommitTx.defaultExpectation == nil {
		mmCommitTx.defaultExpectation = &ThingImageRepositoryMockCommitTxExpectation{mock: mmCommitTx.mock}
	}
	mmCommitTx.defaultExpectation.results = &ThingImageRepositoryMockCommitTxResults{err}
	return mmCommitTx.mock
}

// Set uses given function f to mock the ThingImageRepository.CommitTx method
func (mmCommitTx *mThingImageRepositoryMockCommitTx) Set(f func(tx *sql.Tx) (err error)) *ThingImageRepositoryMock {
	if mmCommitTx.defaultExpectation != nil {
		mmCommitTx.mock.t.Fatalf("Default expectation is already set for the ThingImageRepository.CommitTx method")
	}

	if len(mmCommitTx.expectations) > 0 {
		mmCommitTx.mock.t.Fatalf("Some expectations are already set for the ThingImageRepository.CommitTx method")
	}

	mmCommitTx.mock.funcCommitTx = f
	return mmCommitTx.mock
}

// When sets expectation for the ThingImageRepository.CommitTx which will trigger the result defined by the following
// Then helper
func (mmCommitTx *mThingImageRepositoryMockCommitTx) When(tx *sql.Tx) *ThingImageRepositoryMockCommitTxExpectation {
	if mmCommitTx.mock.funcCommitTx != nil {
		mmCommitTx.mock.t.Fatalf("ThingImageRepositoryMock.CommitTx mock is already set by Set")
	}

	expectation := &ThingImageRepositoryMockCommitTxExpectation{
		mock:   mmCommitTx.mock,
		params: &ThingImageRepositoryMockCommitTxParams{tx},
	}
	mmCommitTx.expectations = append(mmCommitTx.expectations, expectation)
	return expectation
}

// Then sets up ThingImageRepository.CommitTx return parameters for the expectation previously defined by the When method
func (e *ThingImageRepositoryMockCommitTxExpectation) Then(err error) *ThingImageRepositoryMock {
	e.results = &ThingImageRepositoryMockCommitTxResults{err}
	return e.mock
}

// CommitTx implements interfaces.ThingImageRepository
func (mmCommitTx *ThingImageRepositoryMock) CommitTx(tx *sql.Tx) (err error) {
	mm_atomic.AddUint64(&mmCommitTx.beforeCommitTxCounter, 1)
	defer mm_atomic.AddUint64(&mmCommitTx.afterCommitTxCounter, 1)

	if mmCommitTx.inspectFuncCommitTx != nil {
		mmCommitTx.inspectFuncCommitTx(tx)
	}

	mm_params := &ThingImageRepositoryMockCommitTxParams{tx}

	// Record call args
	mmCommitTx.CommitTxMock.mutex.Lock()
	mmCommitTx.CommitTxMock.callArgs = append(mmCommitTx.CommitTxMock.callArgs, mm_params)
	mmCommitTx.CommitTxMock.mutex.Unlock()

	for _, e := range mmCommitTx.CommitTxMock.expectations {
		if minimock.Equal(e.params, mm_params) {
			mm_atomic.AddUint64(&e.Counter, 1)
			return e.results.err
		}
	}

	if mmCommitTx.CommitTxMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmCommitTx.CommitTxMock.defaultExpectation.Counter, 1)
		mm_want := mmCommitTx.CommitTxMock.defaultExpectation.params
		mm_got := ThingImageRepositoryMockCommitTxParams{tx}
		if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmCommitTx.t.Errorf("ThingImageRepositoryMock.CommitTx got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmCommitTx.CommitTxMock.defaultExpectation.results
		if mm_results == nil {
			mmCommitTx.t.Fatal("No results are set for the ThingImageRepositoryMock.CommitTx")
		}
		return (*mm_results).err
	}
	if mmCommitTx.funcCommitTx != nil {
		return mmCommitTx.funcCommitTx(tx)
	}
	mmCommitTx.t.Fatalf("Unexpected call to ThingImageRepositoryMock.CommitTx. %v", tx)
	return
}

// CommitTxAfterCounter returns a count of finished ThingImageRepositoryMock.CommitTx invocations
func (mmCommitTx *ThingImageRepositoryMock) CommitTxAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmCommitTx.afterCommitTxCounter)
}

// CommitTxBeforeCounter returns a count of ThingImageRepositoryMock.CommitTx invocations
func (mmCommitTx *ThingImageRepositoryMock) CommitTxBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmCommitTx.beforeCommitTxCounter)
}

// Calls returns a list of arguments used in each call to ThingImageRepositoryMock.CommitTx.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmCommitTx *mThingImageRepositoryMockCommitTx) Calls() []*ThingImageRepositoryMockCommitTxParams {
	mmCommitTx.mutex.RLock()

	argCopy := make([]*ThingImageRepositoryMockCommitTxParams, len(mmCommitTx.callArgs))
	copy(argCopy, mmCommitTx.callArgs)

	mmCommitTx.mutex.RUnlock()

	return argCopy
}

// MinimockCommitTxDone returns true if the count of the CommitTx invocations corresponds
// the number of defined expectations
func (m *ThingImageRepositoryMock) MinimockCommitTxDone() bool {
	for _, e := range m.CommitTxMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.CommitTxMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterCommitTxCounter) < 1 {
		return false
	}
	// if func was set then invocations count should be greater than zero
	if m.funcCommitTx != nil && mm_atomic.LoadUint64(&m.afterCommitTxCounter) < 1 {
		return false
	}
	return true
}

// MinimockCommitTxInspect logs each unmet expectation
func (m *ThingImageRepositoryMock) MinimockCommitTxInspect() {
	for _, e := range m.CommitTxMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			m.t.Errorf("Expected call to ThingImageRepositoryMock.CommitTx with params: %#v", *e.params)
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.CommitTxMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterCommitTxCounter) < 1 {
		if m.CommitTxMock.defaultExpectation.params == nil {
			m.t.Error("Expected call to ThingImageRepositoryMock.CommitTx")
		} else {
			m.t.Errorf("Expected call to ThingImageRepositoryMock.CommitTx with params: %#v", *m.CommitTxMock.defaultExpectation.params)
		}
	}
	// if func was set then invocations count should be greater than zero
	if m.funcCommitTx != nil && mm_atomic.LoadUint64(&m.afterCommitTxCounter) < 1 {
		m.t.Error("Expected call to ThingImageRepositoryMock.CommitTx")
	}
}

type mThingImageRepositoryMockDelete struct {
	mock               *ThingImageRepositoryMock
	defaultExpectation *ThingImageRepositoryMockDeleteExpectation
	expectations       []*ThingImageRepositoryMockDeleteExpectation

	callArgs []*ThingImageRepositoryMockDeleteParams
	mutex    sync.RWMutex
}

// ThingImageRepositoryMockDeleteExpectation specifies expectation struct of the ThingImageRepository.Delete
type ThingImageRepositoryMockDeleteExpectation struct {
	mock    *ThingImageRepositoryMock
	params  *ThingImageRepositoryMockDeleteParams
	results *ThingImageRepositoryMockDeleteResults
	Counter uint64
}

// ThingImageRepositoryMockDeleteParams contains parameters of the ThingImageRepository.Delete
type ThingImageRepositoryMockDeleteParams struct {
	ctx     context.Context
	imageID int
	tx      *sql.Tx
}

// ThingImageRepositoryMockDeleteResults contains results of the ThingImageRepository.Delete
type ThingImageRepositoryMockDeleteResults struct {
	err error
}

// Expect sets up expected params for ThingImageRepository.Delete
func (mmDelete *mThingImageRepositoryMockDelete) Expect(ctx context.Context, imageID int, tx *sql.Tx) *mThingImageRepositoryMockDelete {
	if mmDelete.mock.funcDelete != nil {
		mmDelete.mock.t.Fatalf("ThingImageRepositoryMock.Delete mock is already set by Set")
	}

	if mmDelete.defaultExpectation == nil {
		mmDelete.defaultExpectation = &ThingImageRepositoryMockDeleteExpectation{}
	}

	mmDelete.defaultExpectation.params = &ThingImageRepositoryMockDeleteParams{ctx, imageID, tx}
	for _, e := range mmDelete.expectations {
		if minimock.Equal(e.params, mmDelete.defaultExpectation.params) {
			mmDelete.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmDelete.defaultExpectation.params)
		}
	}

	return mmDelete
}

// Inspect accepts an inspector function that has same arguments as the ThingImageRepository.Delete
func (mmDelete *mThingImageRepositoryMockDelete) Inspect(f func(ctx context.Context, imageID int, tx *sql.Tx)) *mThingImageRepositoryMockDelete {
	if mmDelete.mock.inspectFuncDelete != nil {
		mmDelete.mock.t.Fatalf("Inspect function is already set for ThingImageRepositoryMock.Delete")
	}

	mmDelete.mock.inspectFuncDelete = f

	return mmDelete
}

// Return sets up results that will be returned by ThingImageRepository.Delete
func (mmDelete *mThingImageRepositoryMockDelete) Return(err error) *ThingImageRepositoryMock {
	if mmDelete.mock.funcDelete != nil {
		mmDelete.mock.t.Fatalf("ThingImageRepositoryMock.Delete mock is already set by Set")
	}

	if mmDelete.defaultExpectation == nil {
		mmDelete.defaultExpectation = &ThingImageRepositoryMockDeleteExpectation{mock: mmDelete.mock}
	}
	mmDelete.defaultExpectation.results = &ThingImageRepositoryMockDeleteResults{err}
	return mmDelete.mock
}

// Set uses given function f to mock the ThingImageRepository.Delete method
func (mmDelete *mThingImageRepositoryMockDelete) Set(f func(ctx context.Context, imageID int, tx *sql.Tx) (err error)) *ThingImageRepositoryMock {
	if mmDelete.defaultExpectation != nil {
		mmDelete.mock.t.Fatalf("Default expectation is already set for the ThingImageRepository.Delete method")
	}

	if len(mmDelete.expectations) > 0 {
		mmDelete.mock.t.Fatalf("Some expectations are already set for the ThingImageRepository.Delete method")
	}

	mmDelete.mock.funcDelete = f
	return mmDelete.mock
}

// When sets expectation for the ThingImageRepository.Delete which will trigger the result defined by the following
// Then helper
func (mmDelete *mThingImageRepositoryMockDelete) When(ctx context.Context, imageID int, tx *sql.Tx) *ThingImageRepositoryMockDeleteExpectation {
	if mmDelete.mock.funcDelete != nil {
		mmDelete.mock.t.Fatalf("ThingImageRepositoryMock.Delete mock is already set by Set")
	}

	expectation := &ThingImageRepositoryMockDeleteExpectation{
		mock:   mmDelete.mock,
		params: &ThingImageRepositoryMockDeleteParams{ctx, imageID, tx},
	}
	mmDelete.expectations = append(mmDelete.expectations, expectation)
	return expectation
}

// Then sets up ThingImageRepository.Delete return parameters for the expectation previously defined by the When method
func (e *ThingImageRepositoryMockDeleteExpectation) Then(err error) *ThingImageRepositoryMock {
	e.results = &ThingImageRepositoryMockDeleteResults{err}
	return e.mock
}

// Delete implements interfaces.ThingImageRepository
func (mmDelete *ThingImageRepositoryMock) Delete(ctx context.Context, imageID int, tx *sql.Tx) (err error) {
	mm_atomic.AddUint64(&mmDelete.beforeDeleteCounter, 1)
	defer mm_atomic.AddUint64(&mmDelete.afterDeleteCounter, 1)

	if mmDelete.inspectFuncDelete != nil {
		mmDelete.inspectFuncDelete(ctx, imageID, tx)
	}

	mm_params := &ThingImageRepositoryMockDeleteParams{ctx, imageID, tx}

	// Record call args
	mmDelete.DeleteMock.mutex.Lock()
	mmDelete.DeleteMock.callArgs = append(mmDelete.DeleteMock.callArgs, mm_params)
	mmDelete.DeleteMock.mutex.Unlock()

	for _, e := range mmDelete.DeleteMock.expectations {
		if minimock.Equal(e.params, mm_params) {
			mm_atomic.AddUint64(&e.Counter, 1)
			return e.results.err
		}
	}

	if mmDelete.DeleteMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmDelete.DeleteMock.defaultExpectation.Counter, 1)
		mm_want := mmDelete.DeleteMock.defaultExpectation.params
		mm_got := ThingImageRepositoryMockDeleteParams{ctx, imageID, tx}
		if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmDelete.t.Errorf("ThingImageRepositoryMock.Delete got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmDelete.DeleteMock.defaultExpectation.results
		if mm_results == nil {
			mmDelete.t.Fatal("No results are set for the ThingImageRepositoryMock.Delete")
		}
		return (*mm_results).err
	}
	if mmDelete.funcDelete != nil {
		return mmDelete.funcDelete(ctx, imageID, tx)
	}
	mmDelete.t.Fatalf("Unexpected call to ThingImageRepositoryMock.Delete. %v %v %v", ctx, imageID, tx)
	return
}

// DeleteAfterCounter returns a count of finished ThingImageRepositoryMock.Delete invocations
func (mmDelete *ThingImageRepositoryMock) DeleteAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmDelete.afterDeleteCounter)
}

// DeleteBeforeCounter returns a count of ThingImageRepositoryMock.Delete invocations
func (mmDelete *ThingImageRepositoryMock) DeleteBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmDelete.beforeDeleteCounter)
}

// Calls returns a list of arguments used in each call to ThingImageRepositoryMock.Delete.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmDelete *mThingImageRepositoryMockDelete) Calls() []*ThingImageRepositoryMockDeleteParams {
	mmDelete.mutex.RLock()

	argCopy := make([]*ThingImageRepositoryMockDeleteParams, len(mmDelete.callArgs))
	copy(argCopy, mmDelete.callArgs)

	mmDelete.mutex.RUnlock()

	return argCopy
}

// MinimockDeleteDone returns true if the count of the Delete invocations corresponds
// the number of defined expectations
func (m *ThingImageRepositoryMock) MinimockDeleteDone() bool {
	for _, e := range m.DeleteMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.DeleteMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDeleteCounter) < 1 {
		return false
	}
	// if func was set then invocations count should be greater than zero
	if m.funcDelete != nil && mm_atomic.LoadUint64(&m.afterDeleteCounter) < 1 {
		return false
	}
	return true
}

// MinimockDeleteInspect logs each unmet expectation
func (m *ThingImageRepositoryMock) MinimockDeleteInspect() {
	for _, e := range m.DeleteMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			m.t.Errorf("Expected call to ThingImageRepositoryMock.Delete with params: %#v", *e.params)
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.DeleteMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDeleteCounter) < 1 {
		if m.DeleteMock.defaultExpectation.params == nil {
			m.t.Error("Expected call to ThingImageRepositoryMock.Delete")
		} else {
			m.t.Errorf("Expected call to ThingImageRepositoryMock.Delete with params: %#v", *m.DeleteMock.defaultExpectation.params)
		}
	}
	// if func was set then invocations count should be greater than zero
	if m.funcDelete != nil && mm_atomic.LoadUint64(&m.afterDeleteCounter) < 1 {
		m.t.Error("Expected call to ThingImageRepositoryMock.Delete")
	}
}

type mThingImageRepositoryMockGet struct {
	mock               *ThingImageRepositoryMock
	defaultExpectation *ThingImageRepositoryMockGetExpectation
	expectations       []*ThingImageRepositoryMockGetExpectation

	callArgs []*ThingImageRepositoryMockGetParams
	mutex    sync.RWMutex
}

// ThingImageRepositoryMockGetExpectation specifies expectation struct of the ThingImageRepository.Get
type ThingImageRepositoryMockGetExpectation struct {
	mock    *ThingImageRepositoryMock
	params  *ThingImageRepositoryMockGetParams
	results *ThingImageRepositoryMockGetResults
	Counter uint64
}

// ThingImageRepositoryMockGetParams contains parameters of the ThingImageRepository.Get
type ThingImageRepositoryMockGetParams struct {
	ctx     context.Context
	imageID int
}

// ThingImageRepositoryMockGetResults contains results of the ThingImageRepository.Get
type ThingImageRepositoryMockGetResults struct {
	ip1 *models.Image
	err error
}

// Expect sets up expected params for ThingImageRepository.Get
func (mmGet *mThingImageRepositoryMockGet) Expect(ctx context.Context, imageID int) *mThingImageRepositoryMockGet {
	if mmGet.mock.funcGet != nil {
		mmGet.mock.t.Fatalf("ThingImageRepositoryMock.Get mock is already set by Set")
	}

	if mmGet.defaultExpectation == nil {
		mmGet.defaultExpectation = &ThingImageRepositoryMockGetExpectation{}
	}

	mmGet.defaultExpectation.params = &ThingImageRepositoryMockGetParams{ctx, imageID}
	for _, e := range mmGet.expectations {
		if minimock.Equal(e.params, mmGet.defaultExpectation.params) {
			mmGet.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGet.defaultExpectation.params)
		}
	}

	return mmGet
}

// Inspect accepts an inspector function that has same arguments as the ThingImageRepository.Get
func (mmGet *mThingImageRepositoryMockGet) Inspect(f func(ctx context.Context, imageID int)) *mThingImageRepositoryMockGet {
	if mmGet.mock.inspectFuncGet != nil {
		mmGet.mock.t.Fatalf("Inspect function is already set for ThingImageRepositoryMock.Get")
	}

	mmGet.mock.inspectFuncGet = f

	return mmGet
}

// Return sets up results that will be returned by ThingImageRepository.Get
func (mmGet *mThingImageRepositoryMockGet) Return(ip1 *models.Image, err error) *ThingImageRepositoryMock {
	if mmGet.mock.funcGet != nil {
		mmGet.mock.t.Fatalf("ThingImageRepositoryMock.Get mock is already set by Set")
	}

	if mmGet.defaultExpectation == nil {
		mmGet.defaultExpectation = &ThingImageRepositoryMockGetExpectation{mock: mmGet.mock}
	}
	mmGet.defaultExpectation.results = &ThingImageRepositoryMockGetResults{ip1, err}
	return mmGet.mock
}

// Set uses given function f to mock the ThingImageRepository.Get method
func (mmGet *mThingImageRepositoryMockGet) Set(f func(ctx context.Context, imageID int) (ip1 *models.Image, err error)) *ThingImageRepositoryMock {
	if mmGet.defaultExpectation != nil {
		mmGet.mock.t.Fatalf("Default expectation is already set for the ThingImageRepository.Get method")
	}

	if len(mmGet.expectations) > 0 {
		mmGet.mock.t.Fatalf("Some expectations are already set for the ThingImageRepository.Get method")
	}

	mmGet.mock.funcGet = f
	return mmGet.mock
}

// When sets expectation for the ThingImageRepository.Get which will trigger the result defined by the following
// Then helper
func (mmGet *mThingImageRepositoryMockGet) When(ctx context.Context, imageID int) *ThingImageRepositoryMockGetExpectation {
	if mmGet.mock.funcGet != nil {
		mmGet.mock.t.Fatalf("ThingImageRepositoryMock.Get mock is already set by Set")
	}

	expectation := &ThingImageRepositoryMockGetExpectation{
		mock:   mmGet.mock,
		params: &ThingImageRepositoryMockGetParams{ctx, imageID},
	}
	mmGet.expectations = append(mmGet.expectations, expectation)
	return expectation
}

// Then sets up ThingImageRepository.Get return parameters for the expectation previously defined by the When method
func (e *ThingImageRepositoryMockGetExpectation) Then(ip1 *models.Image, err error) *ThingImageRepositoryMock {
	e.results = &ThingImageRepositoryMockGetResults{ip1, err}
	return e.mock
}

// Get implements interfaces.ThingImageRepository
func (mmGet *ThingImageRepositoryMock) Get(ctx context.Context, imageID int) (ip1 *models.Image, err error) {
	mm_atomic.AddUint64(&mmGet.beforeGetCounter, 1)
	defer mm_atomic.AddUint64(&mmGet.afterGetCounter, 1)

	if mmGet.inspectFuncGet != nil {
		mmGet.inspectFuncGet(ctx, imageID)
	}

	mm_params := &ThingImageRepositoryMockGetParams{ctx, imageID}

	// Record call args
	mmGet.GetMock.mutex.Lock()
	mmGet.GetMock.callArgs = append(mmGet.GetMock.callArgs, mm_params)
	mmGet.GetMock.mutex.Unlock()

	for _, e := range mmGet.GetMock.expectations {
		if minimock.Equal(e.params, mm_params) {
			mm_atomic.AddUint64(&e.Counter, 1)
			return e.results.ip1, e.results.err
		}
	}

	if mmGet.GetMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmGet.GetMock.defaultExpectation.Counter, 1)
		mm_want := mmGet.GetMock.defaultExpectation.params
		mm_got := ThingImageRepositoryMockGetParams{ctx, imageID}
		if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmGet.t.Errorf("ThingImageRepositoryMock.Get got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmGet.GetMock.defaultExpectation.results
		if mm_results == nil {
			mmGet.t.Fatal("No results are set for the ThingImageRepositoryMock.Get")
		}
		return (*mm_results).ip1, (*mm_results).err
	}
	if mmGet.funcGet != nil {
		return mmGet.funcGet(ctx, imageID)
	}
	mmGet.t.Fatalf("Unexpected call to ThingImageRepositoryMock.Get. %v %v", ctx, imageID)
	return
}

// GetAfterCounter returns a count of finished ThingImageRepositoryMock.Get invocations
func (mmGet *ThingImageRepositoryMock) GetAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmGet.afterGetCounter)
}

// GetBeforeCounter returns a count of ThingImageRepositoryMock.Get invocations
func (mmGet *ThingImageRepositoryMock) GetBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmGet.beforeGetCounter)
}

// Calls returns a list of arguments used in each call to ThingImageRepositoryMock.Get.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmGet *mThingImageRepositoryMockGet) Calls() []*ThingImageRepositoryMockGetParams {
	mmGet.mutex.RLock()

	argCopy := make([]*ThingImageRepositoryMockGetParams, len(mmGet.callArgs))
	copy(argCopy, mmGet.callArgs)

	mmGet.mutex.RUnlock()

	return argCopy
}

// MinimockGetDone returns true if the count of the Get invocations corresponds
// the number of defined expectations
func (m *ThingImageRepositoryMock) MinimockGetDone() bool {
	for _, e := range m.GetMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.GetMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetCounter) < 1 {
		return false
	}
	// if func was set then invocations count should be greater than zero
	if m.funcGet != nil && mm_atomic.LoadUint64(&m.afterGetCounter) < 1 {
		return false
	}
	return true
}

// MinimockGetInspect logs each unmet expectation
func (m *ThingImageRepositoryMock) MinimockGetInspect() {
	for _, e := range m.GetMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			m.t.Errorf("Expected call to ThingImageRepositoryMock.Get with params: %#v", *e.params)
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.GetMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetCounter) < 1 {
		if m.GetMock.defaultExpectation.params == nil {
			m.t.Error("Expected call to ThingImageRepositoryMock.Get")
		} else {
			m.t.Errorf("Expected call to ThingImageRepositoryMock.Get with params: %#v", *m.GetMock.defaultExpectation.params)
		}
	}
	// if func was set then invocations count should be greater than zero
	if m.funcGet != nil && mm_atomic.LoadUint64(&m.afterGetCounter) < 1 {
		m.t.Error("Expected call to ThingImageRepositoryMock.Get")
	}
}

type mThingImageRepositoryMockGetByPlaceID struct {
	mock               *ThingImageRepositoryMock
	defaultExpectation *ThingImageRepositoryMockGetByPlaceIDExpectation
	expectations       []*ThingImageRepositoryMockGetByPlaceIDExpectation

	callArgs []*ThingImageRepositoryMockGetByPlaceIDParams
	mutex    sync.RWMutex
}

// ThingImageRepositoryMockGetByPlaceIDExpectation specifies expectation struct of the ThingImageRepository.GetByPlaceID
type ThingImageRepositoryMockGetByPlaceIDExpectation struct {
	mock    *ThingImageRepositoryMock
	params  *ThingImageRepositoryMockGetByPlaceIDParams
	results *ThingImageRepositoryMockGetByPlaceIDResults
	Counter uint64
}

// ThingImageRepositoryMockGetByPlaceIDParams contains parameters of the ThingImageRepository.GetByPlaceID
type ThingImageRepositoryMockGetByPlaceIDParams struct {
	ctx     context.Context
	placeID int
}

// ThingImageRepositoryMockGetByPlaceIDResults contains results of the ThingImageRepository.GetByPlaceID
type ThingImageRepositoryMockGetByPlaceIDResults struct {
	ia1 []models.Image
	err error
}

// Expect sets up expected params for ThingImageRepository.GetByPlaceID
func (mmGetByPlaceID *mThingImageRepositoryMockGetByPlaceID) Expect(ctx context.Context, placeID int) *mThingImageRepositoryMockGetByPlaceID {
	if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
		mmGetByPlaceID.mock.t.Fatalf("ThingImageRepositoryMock.GetByPlaceID mock is already set by Set")
	}

	if mmGetByPlaceID.defaultExpectation == nil {
		mmGetByPlaceID.defaultExpectation = &ThingImageRepositoryMockGetByPlaceIDExpectation{}
	}

	mmGetByPlaceID.defaultExpectation.params = &ThingImageRepositoryMockGetByPlaceIDParams{ctx, placeID}
	for _, e := range mmGetByPlaceID.expectations {
		if minimock.Equal(e.params, mmGetByPlaceID.defaultExpectation.params) {
			mmGetByPlaceID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetByPlaceID.defaultExpectation.params)
		}
	}

	return mmGetByPlaceID
}

// Inspect accepts an inspector function that has same arguments as the ThingImageRepository.GetByPlaceID
func (mmGetByPlaceID *mThingImageRepositoryMockGetByPlaceID) Inspect(f func(ctx context.Context, placeID int)) *mThingImageRepositoryMockGetByPlaceID {
	if mmGetByPlaceID.mock.inspectFuncGetByPlaceID != nil {
		mmGetByPlaceID.mock.t.Fatalf("Inspect function is already set for ThingImageRepositoryMock.GetByPlaceID")
	}

	mmGetByPlaceID.mock.inspectFuncGetByPlaceID = f

	return mmGetByPlaceID
}

// Return sets up results that will be returned by ThingImageRepository.GetByPlaceID
func (mmGetByPlaceID *mThingImageRepositoryMockGetByPlaceID) Return(ia1 []models.Image, err error) *ThingImageRepositoryMock {
	if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
		mmGetByPlaceID.mock.t.Fatalf("ThingImageRepositoryMock.GetByPlaceID mock is already set by Set")
	}

	if mmGetByPlaceID.defaultExpectation == nil {
		mmGetByPlaceID.defaultExpectation = &ThingImageRepositoryMockGetByPlaceIDExpectation{mock: mmGetByPlaceID.mock}
	}
	mmGetByPlaceID.defaultExpectation.results = &ThingImageRepositoryMockGetByPlaceIDResults{ia1, err}
	return mmGetByPlaceID.mock
}

// Set uses given function f to mock the ThingImageRepository.GetByPlaceID method
func (mmGetByPlaceID *mThingImageRepositoryMockGetByPlaceID) Set(f func(ctx context.Context, placeID int) (ia1 []models.Image, err error)) *ThingImageRepositoryMock {
	if mmGetByPlaceID.defaultExpectation != nil {
		mmGetByPlaceID.mock.t.Fatalf("Default expectation is already set for the ThingImageRepository.GetByPlaceID method")
	}

	if len(mmGetByPlaceID.expectations) > 0 {
		mmGetByPlaceID.mock.t.Fatalf("Some expectations are already set for the ThingImageRepository.GetByPlaceID method")
	}

	mmGetByPlaceID.mock.funcGetByPlaceID = f
	return mmGetByPlaceID.mock
}

// When sets expectation for the ThingImageRepository.GetByPlaceID which will trigger the result defined by the following
// Then helper
func (mmGetByPlaceID *mThingImageRepositoryMockGetByPlaceID) When(ctx context.Context, placeID int) *ThingImageRepositoryMockGetByPlaceIDExpectation {
	if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
		mmGetByPlaceID.mock.t.Fatalf("ThingImageRepositoryMock.GetByPlaceID mock is already set by Set")
	}

	expectation := &ThingImageRepositoryMockGetByPlaceIDExpectation{
		mock:   mmGetByPlaceID.mock,
		params: &ThingImageRepositoryMockGetByPlaceIDParams{ctx, placeID},
	}
	mmGetByPlaceID.expectations = append(mmGetByPlaceID.expectations, expectation)
	return expectation
}

// Then sets up ThingImageRepository.GetByPlaceID return parameters for the expectation previously defined by the When method
func (e *ThingImageRepositoryMockGetByPlaceIDExpectation) Then(ia1 []models.Image, err error) *ThingImageRepositoryMock {
	e.results = &ThingImageRepositoryMockGetByPlaceIDResults{ia1, err}
	return e.mock
}

// GetByPlaceID implements interfaces.ThingImageRepository
func (mmGetByPlaceID *ThingImageRepositoryMock) GetByPlaceID(ctx context.Context, placeID int) (ia1 []models.Image, err error) {
	mm_atomic.AddUint64(&mmGetByPlaceID.beforeGetByPlaceIDCounter, 1)
	defer mm_atomic.AddUint64(&mmGetByPlaceID.afterGetByPlaceIDCounter, 1)

	if mmGetByPlaceID.inspectFuncGetByPlaceID != nil {
		mmGetByPlaceID.inspectFuncGetByPlaceID(ctx, placeID)
	}

	mm_params := &ThingImageRepositoryMockGetByPlaceIDParams{ctx, placeID}

	// Record call args
	mmGetByPlaceID.GetByPlaceIDMock.mutex.Lock()
	mmGetByPlaceID.GetByPlaceIDMock.callArgs = append(mmGetByPlaceID.GetByPlaceIDMock.callArgs, mm_params)
	mmGetByPlaceID.GetByPlaceIDMock.mutex.Unlock()

	for _, e := range mmGetByPlaceID.GetByPlaceIDMock.expectations {
		if minimock.Equal(e.params, mm_params) {
			mm_atomic.AddUint64(&e.Counter, 1)
			return e.results.ia1, e.results.err
		}
	}

	if mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.Counter, 1)
		mm_want := mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.params
		mm_got := ThingImageRepositoryMockGetByPlaceIDParams{ctx, placeID}
		if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmGetByPlaceID.t.Errorf("ThingImageRepositoryMock.GetByPlaceID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.results
		if mm_results == nil {
			mmGetByPlaceID.t.Fatal("No results are set for the ThingImageRepositoryMock.GetByPlaceID")
		}
		return (*mm_results).ia1, (*mm_results).err
	}
	if mmGetByPlaceID.funcGetByPlaceID != nil {
		return mmGetByPlaceID.funcGetByPlaceID(ctx, placeID)
	}
	mmGetByPlaceID.t.Fatalf("Unexpected call to ThingImageRepositoryMock.GetByPlaceID. %v %v", ctx, placeID)
	return
}

// GetByPlaceIDAfterCounter returns a count of finished ThingImageRepositoryMock.GetByPlaceID invocations
func (mmGetByPlaceID *ThingImageRepositoryMock) GetByPlaceIDAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmGetByPlaceID.afterGetByPlaceIDCounter)
}

// GetByPlaceIDBeforeCounter returns a count of ThingImageRepositoryMock.GetByPlaceID invocations
func (mmGetByPlaceID *ThingImageRepositoryMock) GetByPlaceIDBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmGetByPlaceID.beforeGetByPlaceIDCounter)
}

// Calls returns a list of arguments used in each call to ThingImageRepositoryMock.GetByPlaceID.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmGetByPlaceID *mThingImageRepositoryMockGetByPlaceID) Calls() []*ThingImageRepositoryMockGetByPlaceIDParams {
	mmGetByPlaceID.mutex.RLock()

	argCopy := make([]*ThingImageRepositoryMockGetByPlaceIDParams, len(mmGetByPlaceID.callArgs))
	copy(argCopy, mmGetByPlaceID.callArgs)

	mmGetByPlaceID.mutex.RUnlock()

	return argCopy
}

// MinimockGetByPlaceIDDone returns true if the count of the GetByPlaceID invocations corresponds
// the number of defined expectations
func (m *ThingImageRepositoryMock) MinimockGetByPlaceIDDone() bool {
	for _, e := range m.GetByPlaceIDMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.GetByPlaceIDMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetByPlaceIDCounter) < 1 {
		return false
	}
	// if func was set then invocations count should be greater than zero
	if m.funcGetByPlaceID != nil && mm_atomic.LoadUint64(&m.afterGetByPlaceIDCounter) < 1 {
		return false
	}
	return true
}

// MinimockGetByPlaceIDInspect logs each unmet expectation
func (m *ThingImageRepositoryMock) MinimockGetByPlaceIDInspect() {
	for _, e := range m.GetByPlaceIDMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			m.t.Errorf("Expected call to ThingImageRepositoryMock.GetByPlaceID with params: %#v", *e.params)
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.GetByPlaceIDMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetByPlaceIDCounter) < 1 {
		if m.GetByPlaceIDMock.defaultExpectation.params == nil {
			m.t.Error("Expected call to ThingImageRepositoryMock.GetByPlaceID")
		} else {
			m.t.Errorf("Expected call to ThingImageRepositoryMock.GetByPlaceID with params: %#v", *m.GetByPlaceIDMock.defaultExpectation.params)
		}
	}
	// if func was set then invocations count should be greater than zero
	if m.funcGetByPlaceID != nil && mm_atomic.LoadUint64(&m.afterGetByPlaceIDCounter) < 1 {
		m.t.Error("Expected call to ThingImageRepositoryMock.GetByPlaceID")
	}
}

type mThingImageRepositoryMockGetByThingID struct {
	mock               *ThingImageRepositoryMock
	defaultExpectation *ThingImageRepositoryMockGetByThingIDExpectation
	expectations       []*ThingImageRepositoryMockGetByThingIDExpectation

	callArgs []*ThingImageRepositoryMockGetByThingIDParams
	mutex    sync.RWMutex
}

// ThingImageRepositoryMockGetByThingIDExpectation specifies expectation struct of the ThingImageRepository.GetByThingID
type ThingImageRepositoryMockGetByThingIDExpectation struct {
	mock    *ThingImageRepositoryMock
	params  *ThingImageRepositoryMockGetByThingIDParams
	results *ThingImageRepositoryMockGetByThingIDResults
	Counter uint64
}

// ThingImageRepositoryMockGetByThingIDParams contains parameters of the ThingImageRepository.GetByThingID
type ThingImageRepositoryMockGetByThingIDParams struct {
	ctx     context.Context
	thingID int
}

// ThingImageRepositoryMockGetByThingIDResults contains results of the ThingImageRepository.GetByThingID
type ThingImageRepositoryMockGetByThingIDResults struct {
	ia1 []models.Image
	err error
}

// Expect sets up expected params for ThingImageRepository.GetByThingID
func (mmGetByThingID *mThingImageRepositoryMockGetByThingID) Expect(ctx context.Context, thingID int) *mThingImageRepositoryMockGetByThingID {
	if mmGetByThingID.mock.funcGetByThingID != nil {
		mmGetByThingID.mock.t.Fatalf("ThingImageRepositoryMock.GetByThingID mock is already set by Set")
	}

	if mmGetByThingID.defaultExpectation == nil {
		mmGetByThingID.defaultExpectation = &ThingImageRepositoryMockGetByThingIDExpectation{}
	}

	mmGetByThingID.defaultExpectation.params = &ThingImageRepositoryMockGetByThingIDParams{ctx, thingID}
	for _, e := range mmGetByThingID.expectations {
		if minimock.Equal(e.params, mmGetByThingID.defaultExpectation.params) {
			mmGetByThingID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetByThingID.defaultExpectation.params)
		}
	}

	return mmGetByThingID
}

// Inspect accepts an inspector function that has same arguments as the ThingImageRepository.GetByThingID
func (mmGetByThingID *mThingImageRepositoryMockGetByThingID) Inspect(f func(ctx context.Context, thingID int)) *mThingImageRepositoryMockGetByThingID {
	if mmGetByThingID.mock.inspectFuncGetByThingID != nil {
		mmGetByThingID.mock.t.Fatalf("Inspect function is already set for ThingImageRepositoryMock.GetByThingID")
	}

	mmGetByThingID.mock.inspectFuncGetByThingID = f

	return mmGetByThingID
}

// Return sets up results that will be returned by ThingImageRepository.GetByThingID
func (mmGetByThingID *mThingImageRepositoryMockGetByThingID) Return(ia1 []models.Image, err error) *ThingImageRepositoryMock {
	if mmGetByThingID.mock.funcGetByThingID != nil {
		mmGetByThingID.mock.t.Fatalf("ThingImageRepositoryMock.GetByThingID mock is already set by Set")
	}

	if mmGetByThingID.defaultExpectation == nil {
		mmGetByThingID.defaultExpectation = &ThingImageRepositoryMockGetByThingIDExpectation{mock: mmGetByThingID.mock}
	}
	mmGetByThingID.defaultExpectation.results = &ThingImageRepositoryMockGetByThingIDResults{ia1, err}
	return mmGetByThingID.mock
}

// Set uses given function f to mock the ThingImageRepository.GetByThingID method
func (mmGetByThingID *mThingImageRepositoryMockGetByThingID) Set(f func(ctx context.Context, thingID int) (ia1 []models.Image, err error)) *ThingImageRepositoryMock {
	if mmGetByThingID.defaultExpectation != nil {
		mmGetByThingID.mock.t.Fatalf("Default expectation is already set for the ThingImageRepository.GetByThingID method")
	}

	if len(mmGetByThingID.expectations) > 0 {
		mmGetByThingID.mock.t.Fatalf("Some expectations are already set for the ThingImageRepository.GetByThingID method")
	}

	mmGetByThingID.mock.funcGetByThingID = f
	return mmGetByThingID.mock
}

// When sets expectation for the ThingImageRepository.GetByThingID which will trigger the result defined by the following
// Then helper
func (mmGetByThingID *mThingImageRepositoryMockGetByThingID) When(ctx context.Context, thingID int) *ThingImageRepositoryMockGetByThingIDExpectation {
	if mmGetByThingID.mock.funcGetByThingID != nil {
		mmGetByThingID.mock.t.Fatalf("ThingImageRepositoryMock.GetByThingID mock is already set by Set")
	}

	expectation := &ThingImageRepositoryMockGetByThingIDExpectation{
		mock:   mmGetByThingID.mock,
		params: &ThingImageRepositoryMockGetByThingIDParams{ctx, thingID},
	}
	mmGetByThingID.expectations = append(mmGetByThingID.expectations, expectation)
	return expectation
}

// Then sets up ThingImageRepository.GetByThingID return parameters for the expectation previously defined by the When method
func (e *ThingImageRepositoryMockGetByThingIDExpectation) Then(ia1 []models.Image, err error) *ThingImageRepositoryMock {
	e.results = &ThingImageRepositoryMockGetByThingIDResults{ia1, err}
	return e.mock
}

// GetByThingID implements interfaces.ThingImageRepository
func (mmGetByThingID *ThingImageRepositoryMock) GetByThingID(ctx context.Context, thingID int) (ia1 []models.Image, err error) {
	mm_atomic.AddUint64(&mmGetByThingID.beforeGetByThingIDCounter, 1)
	defer mm_atomic.AddUint64(&mmGetByThingID.afterGetByThingIDCounter, 1)

	if mmGetByThingID.inspectFuncGetByThingID != nil {
		mmGetByThingID.inspectFuncGetByThingID(ctx, thingID)
	}

	mm_params := &ThingImageRepositoryMockGetByThingIDParams{ctx, thingID}

	// Record call args
	mmGetByThingID.GetByThingIDMock.mutex.Lock()
	mmGetByThingID.GetByThingIDMock.callArgs = append(mmGetByThingID.GetByThingIDMock.callArgs, mm_params)
	mmGetByThingID.GetByThingIDMock.mutex.Unlock()

	for _, e := range mmGetByThingID.GetByThingIDMock.expectations {
		if minimock.Equal(e.params, mm_params) {
			mm_atomic.AddUint64(&e.Counter, 1)
			return e.results.ia1, e.results.err
		}
	}

	if mmGetByThingID.GetByThingIDMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmGetByThingID.GetByThingIDMock.defaultExpectation.Counter, 1)
		mm_want := mmGetByThingID.GetByThingIDMock.defaultExpectation.params
		mm_got := ThingImageRepositoryMockGetByThingIDParams{ctx, thingID}
		if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmGetByThingID.t.Errorf("ThingImageRepositoryMock.GetByThingID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmGetByThingID.GetByThingIDMock.defaultExpectation.results
		if mm_results == nil {
			mmGetByThingID.t.Fatal("No results are set for the ThingImageRepositoryMock.GetByThingID")
		}
		return (*mm_results).ia1, (*mm_results).err
	}
	if mmGetByThingID.funcGetByThingID != nil {
		return mmGetByThingID.funcGetByThingID(ctx, thingID)
	}
	mmGetByThingID.t.Fatalf("Unexpected call to ThingImageRepositoryMock.GetByThingID. %v %v", ctx, thingID)
	return
}

// GetByThingIDAfterCounter returns a count of finished ThingImageRepositoryMock.GetByThingID invocations
func (mmGetByThingID *ThingImageRepositoryMock) GetByThingIDAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmGetByThingID.afterGetByThingIDCounter)
}

// GetByThingIDBeforeCounter returns a count of ThingImageRepositoryMock.GetByThingID invocations
func (mmGetByThingID *ThingImageRepositoryMock) GetByThingIDBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmGetByThingID.beforeGetByThingIDCounter)
}

// Calls returns a list of arguments used in each call to ThingImageRepositoryMock.GetByThingID.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmGetByThingID *mThingImageRepositoryMockGetByThingID) Calls() []*ThingImageRepositoryMockGetByThingIDParams {
	mmGetByThingID.mutex.RLock()

	argCopy := make([]*ThingImageRepositoryMockGetByThingIDParams, len(mmGetByThingID.callArgs))
	copy(argCopy, mmGetByThingID.callArgs)

	mmGetByThingID.mutex.RUnlock()

	return argCopy
}

// MinimockGetByThingIDDone returns true if the count of the GetByThingID invocations corresponds
// the number of defined expectations
func (m *ThingImageRepositoryMock) MinimockGetByThingIDDone() bool {
	for _, e := range m.GetByThingIDMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.GetByThingIDMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetByThingIDCounter) < 1 {
		return false
	}
	// if func was set then invocations count should be greater than zero
	if m.funcGetByThingID != nil && mm_atomic.LoadUint64(&m.afterGetByThingIDCounter) < 1 {
		return false
	}
	return true
}

// MinimockGetByThingIDInspect logs each unmet expectation
func (m *ThingImageRepositoryMock) MinimockGetByThingIDInspect() {
	for _, e := range m.GetByThingIDMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			m.t.Errorf("Expected call to ThingImageRepositoryMock.GetByThingID with params: %#v", *e.params)
		}
	}

	// if default expectation was set then invocations count should be greater than zero
	if m.GetByThingIDMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetByThingIDCounter) < 1 {
		if m.GetByThingIDMock.defaultExpectation.params == nil {
			m.t.Error("Expected call to ThingImageRepositoryMock.GetByThingID")
		} else {
			m.t.Errorf("Expected call to ThingImageRepositoryMock.GetByThingID with params: %#v", *m.GetByThingIDMock.defaultExpectation.params)
		}
	}
	// if func was set then invocations count should be greater than zero
	if m.funcGetByThingID != nil && mm_atomic.LoadUint64(&m.afterGetByThingIDCounter) < 1 {
		m.t.Error("Expected call to ThingImageRepositoryMock.GetByThingID")
	}
}

// MinimockFinish checks that all mocked methods have been called the expected number of times
func (m *ThingImageRepositoryMock) MinimockFinish() {
	if !m.minimockDone() {
		m.MinimockAddInspect()

		m.MinimockBeginTxInspect()

		m.MinimockCommitTxInspect()

		m.MinimockDeleteInspect()

		m.MinimockGetInspect()

		m.MinimockGetByPlaceIDInspect()

		m.MinimockGetByThingIDInspect()
		m.t.FailNow()
	}
}

// MinimockWait waits for all mocked methods to be called the expected number of times
func (m *ThingImageRepositoryMock) MinimockWait(timeout mm_time.Duration) {
	timeoutCh := mm_time.After(timeout)
	for {
		if m.minimockDone() {
			return
		}
		select {
		case <-timeoutCh:
			m.MinimockFinish()
			return
		case <-mm_time.After(10 * mm_time.Millisecond):
		}
	}
}

func (m *ThingImageRepositoryMock) minimockDone() bool {
	done := true
	return done &&
		m.MinimockAddDone() &&
		m.MinimockBeginTxDone() &&
		m.MinimockCommitTxDone() &&
		m.MinimockDeleteDone() &&
		m.MinimockGetDone() &&
		m.MinimockGetByPlaceIDDone() &&
		m.MinimockGetByThingIDDone()
}
