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

package mocks

//go:generate minimock -i git.dmitriygnatenko.ru/dima/homethings/internal/api/v1/thing.ThingTagRepository -o thing_tag_repository_minimock.go -n ThingTagRepositoryMock -p mocks

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

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

// ThingTagRepositoryMock implements thing.ThingTagRepository
type ThingTagRepositoryMock struct {
	t          minimock.Tester
	finishOnce sync.Once

	funcDeleteByThingID          func(ctx context.Context, id uint64) (err error)
	inspectFuncDeleteByThingID   func(ctx context.Context, id uint64)
	afterDeleteByThingIDCounter  uint64
	beforeDeleteByThingIDCounter uint64
	DeleteByThingIDMock          mThingTagRepositoryMockDeleteByThingID

	funcGetByPlaceID          func(ctx context.Context, id uint64) (ta1 []models.ThingTag, err error)
	inspectFuncGetByPlaceID   func(ctx context.Context, id uint64)
	afterGetByPlaceIDCounter  uint64
	beforeGetByPlaceIDCounter uint64
	GetByPlaceIDMock          mThingTagRepositoryMockGetByPlaceID
}

// NewThingTagRepositoryMock returns a mock for thing.ThingTagRepository
func NewThingTagRepositoryMock(t minimock.Tester) *ThingTagRepositoryMock {
	m := &ThingTagRepositoryMock{t: t}

	if controller, ok := t.(minimock.MockController); ok {
		controller.RegisterMocker(m)
	}

	m.DeleteByThingIDMock = mThingTagRepositoryMockDeleteByThingID{mock: m}
	m.DeleteByThingIDMock.callArgs = []*ThingTagRepositoryMockDeleteByThingIDParams{}

	m.GetByPlaceIDMock = mThingTagRepositoryMockGetByPlaceID{mock: m}
	m.GetByPlaceIDMock.callArgs = []*ThingTagRepositoryMockGetByPlaceIDParams{}

	t.Cleanup(m.MinimockFinish)

	return m
}

type mThingTagRepositoryMockDeleteByThingID struct {
	optional           bool
	mock               *ThingTagRepositoryMock
	defaultExpectation *ThingTagRepositoryMockDeleteByThingIDExpectation
	expectations       []*ThingTagRepositoryMockDeleteByThingIDExpectation

	callArgs []*ThingTagRepositoryMockDeleteByThingIDParams
	mutex    sync.RWMutex

	expectedInvocations uint64
}

// ThingTagRepositoryMockDeleteByThingIDExpectation specifies expectation struct of the ThingTagRepository.DeleteByThingID
type ThingTagRepositoryMockDeleteByThingIDExpectation struct {
	mock      *ThingTagRepositoryMock
	params    *ThingTagRepositoryMockDeleteByThingIDParams
	paramPtrs *ThingTagRepositoryMockDeleteByThingIDParamPtrs
	results   *ThingTagRepositoryMockDeleteByThingIDResults
	Counter   uint64
}

// ThingTagRepositoryMockDeleteByThingIDParams contains parameters of the ThingTagRepository.DeleteByThingID
type ThingTagRepositoryMockDeleteByThingIDParams struct {
	ctx context.Context
	id  uint64
}

// ThingTagRepositoryMockDeleteByThingIDParamPtrs contains pointers to parameters of the ThingTagRepository.DeleteByThingID
type ThingTagRepositoryMockDeleteByThingIDParamPtrs struct {
	ctx *context.Context
	id  *uint64
}

// ThingTagRepositoryMockDeleteByThingIDResults contains results of the ThingTagRepository.DeleteByThingID
type ThingTagRepositoryMockDeleteByThingIDResults struct {
	err error
}

// Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning
// the test will fail minimock's automatic final call check if the mocked method was not called at least once.
// Optional() makes method check to work in '0 or more' mode.
// It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to
// catch the problems when the expected method call is totally skipped during test run.
func (mmDeleteByThingID *mThingTagRepositoryMockDeleteByThingID) Optional() *mThingTagRepositoryMockDeleteByThingID {
	mmDeleteByThingID.optional = true
	return mmDeleteByThingID
}

// Expect sets up expected params for ThingTagRepository.DeleteByThingID
func (mmDeleteByThingID *mThingTagRepositoryMockDeleteByThingID) Expect(ctx context.Context, id uint64) *mThingTagRepositoryMockDeleteByThingID {
	if mmDeleteByThingID.mock.funcDeleteByThingID != nil {
		mmDeleteByThingID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByThingID mock is already set by Set")
	}

	if mmDeleteByThingID.defaultExpectation == nil {
		mmDeleteByThingID.defaultExpectation = &ThingTagRepositoryMockDeleteByThingIDExpectation{}
	}

	if mmDeleteByThingID.defaultExpectation.paramPtrs != nil {
		mmDeleteByThingID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByThingID mock is already set by ExpectParams functions")
	}

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

	return mmDeleteByThingID
}

// ExpectCtxParam1 sets up expected param ctx for ThingTagRepository.DeleteByThingID
func (mmDeleteByThingID *mThingTagRepositoryMockDeleteByThingID) ExpectCtxParam1(ctx context.Context) *mThingTagRepositoryMockDeleteByThingID {
	if mmDeleteByThingID.mock.funcDeleteByThingID != nil {
		mmDeleteByThingID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByThingID mock is already set by Set")
	}

	if mmDeleteByThingID.defaultExpectation == nil {
		mmDeleteByThingID.defaultExpectation = &ThingTagRepositoryMockDeleteByThingIDExpectation{}
	}

	if mmDeleteByThingID.defaultExpectation.params != nil {
		mmDeleteByThingID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByThingID mock is already set by Expect")
	}

	if mmDeleteByThingID.defaultExpectation.paramPtrs == nil {
		mmDeleteByThingID.defaultExpectation.paramPtrs = &ThingTagRepositoryMockDeleteByThingIDParamPtrs{}
	}
	mmDeleteByThingID.defaultExpectation.paramPtrs.ctx = &ctx

	return mmDeleteByThingID
}

// ExpectIdParam2 sets up expected param id for ThingTagRepository.DeleteByThingID
func (mmDeleteByThingID *mThingTagRepositoryMockDeleteByThingID) ExpectIdParam2(id uint64) *mThingTagRepositoryMockDeleteByThingID {
	if mmDeleteByThingID.mock.funcDeleteByThingID != nil {
		mmDeleteByThingID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByThingID mock is already set by Set")
	}

	if mmDeleteByThingID.defaultExpectation == nil {
		mmDeleteByThingID.defaultExpectation = &ThingTagRepositoryMockDeleteByThingIDExpectation{}
	}

	if mmDeleteByThingID.defaultExpectation.params != nil {
		mmDeleteByThingID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByThingID mock is already set by Expect")
	}

	if mmDeleteByThingID.defaultExpectation.paramPtrs == nil {
		mmDeleteByThingID.defaultExpectation.paramPtrs = &ThingTagRepositoryMockDeleteByThingIDParamPtrs{}
	}
	mmDeleteByThingID.defaultExpectation.paramPtrs.id = &id

	return mmDeleteByThingID
}

// Inspect accepts an inspector function that has same arguments as the ThingTagRepository.DeleteByThingID
func (mmDeleteByThingID *mThingTagRepositoryMockDeleteByThingID) Inspect(f func(ctx context.Context, id uint64)) *mThingTagRepositoryMockDeleteByThingID {
	if mmDeleteByThingID.mock.inspectFuncDeleteByThingID != nil {
		mmDeleteByThingID.mock.t.Fatalf("Inspect function is already set for ThingTagRepositoryMock.DeleteByThingID")
	}

	mmDeleteByThingID.mock.inspectFuncDeleteByThingID = f

	return mmDeleteByThingID
}

// Return sets up results that will be returned by ThingTagRepository.DeleteByThingID
func (mmDeleteByThingID *mThingTagRepositoryMockDeleteByThingID) Return(err error) *ThingTagRepositoryMock {
	if mmDeleteByThingID.mock.funcDeleteByThingID != nil {
		mmDeleteByThingID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByThingID mock is already set by Set")
	}

	if mmDeleteByThingID.defaultExpectation == nil {
		mmDeleteByThingID.defaultExpectation = &ThingTagRepositoryMockDeleteByThingIDExpectation{mock: mmDeleteByThingID.mock}
	}
	mmDeleteByThingID.defaultExpectation.results = &ThingTagRepositoryMockDeleteByThingIDResults{err}
	return mmDeleteByThingID.mock
}

// Set uses given function f to mock the ThingTagRepository.DeleteByThingID method
func (mmDeleteByThingID *mThingTagRepositoryMockDeleteByThingID) Set(f func(ctx context.Context, id uint64) (err error)) *ThingTagRepositoryMock {
	if mmDeleteByThingID.defaultExpectation != nil {
		mmDeleteByThingID.mock.t.Fatalf("Default expectation is already set for the ThingTagRepository.DeleteByThingID method")
	}

	if len(mmDeleteByThingID.expectations) > 0 {
		mmDeleteByThingID.mock.t.Fatalf("Some expectations are already set for the ThingTagRepository.DeleteByThingID method")
	}

	mmDeleteByThingID.mock.funcDeleteByThingID = f
	return mmDeleteByThingID.mock
}

// When sets expectation for the ThingTagRepository.DeleteByThingID which will trigger the result defined by the following
// Then helper
func (mmDeleteByThingID *mThingTagRepositoryMockDeleteByThingID) When(ctx context.Context, id uint64) *ThingTagRepositoryMockDeleteByThingIDExpectation {
	if mmDeleteByThingID.mock.funcDeleteByThingID != nil {
		mmDeleteByThingID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByThingID mock is already set by Set")
	}

	expectation := &ThingTagRepositoryMockDeleteByThingIDExpectation{
		mock:   mmDeleteByThingID.mock,
		params: &ThingTagRepositoryMockDeleteByThingIDParams{ctx, id},
	}
	mmDeleteByThingID.expectations = append(mmDeleteByThingID.expectations, expectation)
	return expectation
}

// Then sets up ThingTagRepository.DeleteByThingID return parameters for the expectation previously defined by the When method
func (e *ThingTagRepositoryMockDeleteByThingIDExpectation) Then(err error) *ThingTagRepositoryMock {
	e.results = &ThingTagRepositoryMockDeleteByThingIDResults{err}
	return e.mock
}

// Times sets number of times ThingTagRepository.DeleteByThingID should be invoked
func (mmDeleteByThingID *mThingTagRepositoryMockDeleteByThingID) Times(n uint64) *mThingTagRepositoryMockDeleteByThingID {
	if n == 0 {
		mmDeleteByThingID.mock.t.Fatalf("Times of ThingTagRepositoryMock.DeleteByThingID mock can not be zero")
	}
	mm_atomic.StoreUint64(&mmDeleteByThingID.expectedInvocations, n)
	return mmDeleteByThingID
}

func (mmDeleteByThingID *mThingTagRepositoryMockDeleteByThingID) invocationsDone() bool {
	if len(mmDeleteByThingID.expectations) == 0 && mmDeleteByThingID.defaultExpectation == nil && mmDeleteByThingID.mock.funcDeleteByThingID == nil {
		return true
	}

	totalInvocations := mm_atomic.LoadUint64(&mmDeleteByThingID.mock.afterDeleteByThingIDCounter)
	expectedInvocations := mm_atomic.LoadUint64(&mmDeleteByThingID.expectedInvocations)

	return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}

// DeleteByThingID implements thing.ThingTagRepository
func (mmDeleteByThingID *ThingTagRepositoryMock) DeleteByThingID(ctx context.Context, id uint64) (err error) {
	mm_atomic.AddUint64(&mmDeleteByThingID.beforeDeleteByThingIDCounter, 1)
	defer mm_atomic.AddUint64(&mmDeleteByThingID.afterDeleteByThingIDCounter, 1)

	if mmDeleteByThingID.inspectFuncDeleteByThingID != nil {
		mmDeleteByThingID.inspectFuncDeleteByThingID(ctx, id)
	}

	mm_params := ThingTagRepositoryMockDeleteByThingIDParams{ctx, id}

	// Record call args
	mmDeleteByThingID.DeleteByThingIDMock.mutex.Lock()
	mmDeleteByThingID.DeleteByThingIDMock.callArgs = append(mmDeleteByThingID.DeleteByThingIDMock.callArgs, &mm_params)
	mmDeleteByThingID.DeleteByThingIDMock.mutex.Unlock()

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

	if mmDeleteByThingID.DeleteByThingIDMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmDeleteByThingID.DeleteByThingIDMock.defaultExpectation.Counter, 1)
		mm_want := mmDeleteByThingID.DeleteByThingIDMock.defaultExpectation.params
		mm_want_ptrs := mmDeleteByThingID.DeleteByThingIDMock.defaultExpectation.paramPtrs

		mm_got := ThingTagRepositoryMockDeleteByThingIDParams{ctx, id}

		if mm_want_ptrs != nil {

			if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
				mmDeleteByThingID.t.Errorf("ThingTagRepositoryMock.DeleteByThingID got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
			}

			if mm_want_ptrs.id != nil && !minimock.Equal(*mm_want_ptrs.id, mm_got.id) {
				mmDeleteByThingID.t.Errorf("ThingTagRepositoryMock.DeleteByThingID got unexpected parameter id, want: %#v, got: %#v%s\n", *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id))
			}

		} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmDeleteByThingID.t.Errorf("ThingTagRepositoryMock.DeleteByThingID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmDeleteByThingID.DeleteByThingIDMock.defaultExpectation.results
		if mm_results == nil {
			mmDeleteByThingID.t.Fatal("No results are set for the ThingTagRepositoryMock.DeleteByThingID")
		}
		return (*mm_results).err
	}
	if mmDeleteByThingID.funcDeleteByThingID != nil {
		return mmDeleteByThingID.funcDeleteByThingID(ctx, id)
	}
	mmDeleteByThingID.t.Fatalf("Unexpected call to ThingTagRepositoryMock.DeleteByThingID. %v %v", ctx, id)
	return
}

// DeleteByThingIDAfterCounter returns a count of finished ThingTagRepositoryMock.DeleteByThingID invocations
func (mmDeleteByThingID *ThingTagRepositoryMock) DeleteByThingIDAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmDeleteByThingID.afterDeleteByThingIDCounter)
}

// DeleteByThingIDBeforeCounter returns a count of ThingTagRepositoryMock.DeleteByThingID invocations
func (mmDeleteByThingID *ThingTagRepositoryMock) DeleteByThingIDBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmDeleteByThingID.beforeDeleteByThingIDCounter)
}

// Calls returns a list of arguments used in each call to ThingTagRepositoryMock.DeleteByThingID.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmDeleteByThingID *mThingTagRepositoryMockDeleteByThingID) Calls() []*ThingTagRepositoryMockDeleteByThingIDParams {
	mmDeleteByThingID.mutex.RLock()

	argCopy := make([]*ThingTagRepositoryMockDeleteByThingIDParams, len(mmDeleteByThingID.callArgs))
	copy(argCopy, mmDeleteByThingID.callArgs)

	mmDeleteByThingID.mutex.RUnlock()

	return argCopy
}

// MinimockDeleteByThingIDDone returns true if the count of the DeleteByThingID invocations corresponds
// the number of defined expectations
func (m *ThingTagRepositoryMock) MinimockDeleteByThingIDDone() bool {
	if m.DeleteByThingIDMock.optional {
		// Optional methods provide '0 or more' call count restriction.
		return true
	}

	for _, e := range m.DeleteByThingIDMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	return m.DeleteByThingIDMock.invocationsDone()
}

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

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

	if !m.DeleteByThingIDMock.invocationsDone() && afterDeleteByThingIDCounter > 0 {
		m.t.Errorf("Expected %d calls to ThingTagRepositoryMock.DeleteByThingID but found %d calls",
			mm_atomic.LoadUint64(&m.DeleteByThingIDMock.expectedInvocations), afterDeleteByThingIDCounter)
	}
}

type mThingTagRepositoryMockGetByPlaceID struct {
	optional           bool
	mock               *ThingTagRepositoryMock
	defaultExpectation *ThingTagRepositoryMockGetByPlaceIDExpectation
	expectations       []*ThingTagRepositoryMockGetByPlaceIDExpectation

	callArgs []*ThingTagRepositoryMockGetByPlaceIDParams
	mutex    sync.RWMutex

	expectedInvocations uint64
}

// ThingTagRepositoryMockGetByPlaceIDExpectation specifies expectation struct of the ThingTagRepository.GetByPlaceID
type ThingTagRepositoryMockGetByPlaceIDExpectation struct {
	mock      *ThingTagRepositoryMock
	params    *ThingTagRepositoryMockGetByPlaceIDParams
	paramPtrs *ThingTagRepositoryMockGetByPlaceIDParamPtrs
	results   *ThingTagRepositoryMockGetByPlaceIDResults
	Counter   uint64
}

// ThingTagRepositoryMockGetByPlaceIDParams contains parameters of the ThingTagRepository.GetByPlaceID
type ThingTagRepositoryMockGetByPlaceIDParams struct {
	ctx context.Context
	id  uint64
}

// ThingTagRepositoryMockGetByPlaceIDParamPtrs contains pointers to parameters of the ThingTagRepository.GetByPlaceID
type ThingTagRepositoryMockGetByPlaceIDParamPtrs struct {
	ctx *context.Context
	id  *uint64
}

// ThingTagRepositoryMockGetByPlaceIDResults contains results of the ThingTagRepository.GetByPlaceID
type ThingTagRepositoryMockGetByPlaceIDResults struct {
	ta1 []models.ThingTag
	err error
}

// Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning
// the test will fail minimock's automatic final call check if the mocked method was not called at least once.
// Optional() makes method check to work in '0 or more' mode.
// It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to
// catch the problems when the expected method call is totally skipped during test run.
func (mmGetByPlaceID *mThingTagRepositoryMockGetByPlaceID) Optional() *mThingTagRepositoryMockGetByPlaceID {
	mmGetByPlaceID.optional = true
	return mmGetByPlaceID
}

// Expect sets up expected params for ThingTagRepository.GetByPlaceID
func (mmGetByPlaceID *mThingTagRepositoryMockGetByPlaceID) Expect(ctx context.Context, id uint64) *mThingTagRepositoryMockGetByPlaceID {
	if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
		mmGetByPlaceID.mock.t.Fatalf("ThingTagRepositoryMock.GetByPlaceID mock is already set by Set")
	}

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

	if mmGetByPlaceID.defaultExpectation.paramPtrs != nil {
		mmGetByPlaceID.mock.t.Fatalf("ThingTagRepositoryMock.GetByPlaceID mock is already set by ExpectParams functions")
	}

	mmGetByPlaceID.defaultExpectation.params = &ThingTagRepositoryMockGetByPlaceIDParams{ctx, id}
	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
}

// ExpectCtxParam1 sets up expected param ctx for ThingTagRepository.GetByPlaceID
func (mmGetByPlaceID *mThingTagRepositoryMockGetByPlaceID) ExpectCtxParam1(ctx context.Context) *mThingTagRepositoryMockGetByPlaceID {
	if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
		mmGetByPlaceID.mock.t.Fatalf("ThingTagRepositoryMock.GetByPlaceID mock is already set by Set")
	}

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

	if mmGetByPlaceID.defaultExpectation.params != nil {
		mmGetByPlaceID.mock.t.Fatalf("ThingTagRepositoryMock.GetByPlaceID mock is already set by Expect")
	}

	if mmGetByPlaceID.defaultExpectation.paramPtrs == nil {
		mmGetByPlaceID.defaultExpectation.paramPtrs = &ThingTagRepositoryMockGetByPlaceIDParamPtrs{}
	}
	mmGetByPlaceID.defaultExpectation.paramPtrs.ctx = &ctx

	return mmGetByPlaceID
}

// ExpectIdParam2 sets up expected param id for ThingTagRepository.GetByPlaceID
func (mmGetByPlaceID *mThingTagRepositoryMockGetByPlaceID) ExpectIdParam2(id uint64) *mThingTagRepositoryMockGetByPlaceID {
	if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
		mmGetByPlaceID.mock.t.Fatalf("ThingTagRepositoryMock.GetByPlaceID mock is already set by Set")
	}

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

	if mmGetByPlaceID.defaultExpectation.params != nil {
		mmGetByPlaceID.mock.t.Fatalf("ThingTagRepositoryMock.GetByPlaceID mock is already set by Expect")
	}

	if mmGetByPlaceID.defaultExpectation.paramPtrs == nil {
		mmGetByPlaceID.defaultExpectation.paramPtrs = &ThingTagRepositoryMockGetByPlaceIDParamPtrs{}
	}
	mmGetByPlaceID.defaultExpectation.paramPtrs.id = &id

	return mmGetByPlaceID
}

// Inspect accepts an inspector function that has same arguments as the ThingTagRepository.GetByPlaceID
func (mmGetByPlaceID *mThingTagRepositoryMockGetByPlaceID) Inspect(f func(ctx context.Context, id uint64)) *mThingTagRepositoryMockGetByPlaceID {
	if mmGetByPlaceID.mock.inspectFuncGetByPlaceID != nil {
		mmGetByPlaceID.mock.t.Fatalf("Inspect function is already set for ThingTagRepositoryMock.GetByPlaceID")
	}

	mmGetByPlaceID.mock.inspectFuncGetByPlaceID = f

	return mmGetByPlaceID
}

// Return sets up results that will be returned by ThingTagRepository.GetByPlaceID
func (mmGetByPlaceID *mThingTagRepositoryMockGetByPlaceID) Return(ta1 []models.ThingTag, err error) *ThingTagRepositoryMock {
	if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
		mmGetByPlaceID.mock.t.Fatalf("ThingTagRepositoryMock.GetByPlaceID mock is already set by Set")
	}

	if mmGetByPlaceID.defaultExpectation == nil {
		mmGetByPlaceID.defaultExpectation = &ThingTagRepositoryMockGetByPlaceIDExpectation{mock: mmGetByPlaceID.mock}
	}
	mmGetByPlaceID.defaultExpectation.results = &ThingTagRepositoryMockGetByPlaceIDResults{ta1, err}
	return mmGetByPlaceID.mock
}

// Set uses given function f to mock the ThingTagRepository.GetByPlaceID method
func (mmGetByPlaceID *mThingTagRepositoryMockGetByPlaceID) Set(f func(ctx context.Context, id uint64) (ta1 []models.ThingTag, err error)) *ThingTagRepositoryMock {
	if mmGetByPlaceID.defaultExpectation != nil {
		mmGetByPlaceID.mock.t.Fatalf("Default expectation is already set for the ThingTagRepository.GetByPlaceID method")
	}

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

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

// When sets expectation for the ThingTagRepository.GetByPlaceID which will trigger the result defined by the following
// Then helper
func (mmGetByPlaceID *mThingTagRepositoryMockGetByPlaceID) When(ctx context.Context, id uint64) *ThingTagRepositoryMockGetByPlaceIDExpectation {
	if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
		mmGetByPlaceID.mock.t.Fatalf("ThingTagRepositoryMock.GetByPlaceID mock is already set by Set")
	}

	expectation := &ThingTagRepositoryMockGetByPlaceIDExpectation{
		mock:   mmGetByPlaceID.mock,
		params: &ThingTagRepositoryMockGetByPlaceIDParams{ctx, id},
	}
	mmGetByPlaceID.expectations = append(mmGetByPlaceID.expectations, expectation)
	return expectation
}

// Then sets up ThingTagRepository.GetByPlaceID return parameters for the expectation previously defined by the When method
func (e *ThingTagRepositoryMockGetByPlaceIDExpectation) Then(ta1 []models.ThingTag, err error) *ThingTagRepositoryMock {
	e.results = &ThingTagRepositoryMockGetByPlaceIDResults{ta1, err}
	return e.mock
}

// Times sets number of times ThingTagRepository.GetByPlaceID should be invoked
func (mmGetByPlaceID *mThingTagRepositoryMockGetByPlaceID) Times(n uint64) *mThingTagRepositoryMockGetByPlaceID {
	if n == 0 {
		mmGetByPlaceID.mock.t.Fatalf("Times of ThingTagRepositoryMock.GetByPlaceID mock can not be zero")
	}
	mm_atomic.StoreUint64(&mmGetByPlaceID.expectedInvocations, n)
	return mmGetByPlaceID
}

func (mmGetByPlaceID *mThingTagRepositoryMockGetByPlaceID) invocationsDone() bool {
	if len(mmGetByPlaceID.expectations) == 0 && mmGetByPlaceID.defaultExpectation == nil && mmGetByPlaceID.mock.funcGetByPlaceID == nil {
		return true
	}

	totalInvocations := mm_atomic.LoadUint64(&mmGetByPlaceID.mock.afterGetByPlaceIDCounter)
	expectedInvocations := mm_atomic.LoadUint64(&mmGetByPlaceID.expectedInvocations)

	return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}

// GetByPlaceID implements thing.ThingTagRepository
func (mmGetByPlaceID *ThingTagRepositoryMock) GetByPlaceID(ctx context.Context, id uint64) (ta1 []models.ThingTag, err error) {
	mm_atomic.AddUint64(&mmGetByPlaceID.beforeGetByPlaceIDCounter, 1)
	defer mm_atomic.AddUint64(&mmGetByPlaceID.afterGetByPlaceIDCounter, 1)

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

	mm_params := ThingTagRepositoryMockGetByPlaceIDParams{ctx, id}

	// 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.ta1, e.results.err
		}
	}

	if mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.Counter, 1)
		mm_want := mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.params
		mm_want_ptrs := mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.paramPtrs

		mm_got := ThingTagRepositoryMockGetByPlaceIDParams{ctx, id}

		if mm_want_ptrs != nil {

			if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
				mmGetByPlaceID.t.Errorf("ThingTagRepositoryMock.GetByPlaceID got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
			}

			if mm_want_ptrs.id != nil && !minimock.Equal(*mm_want_ptrs.id, mm_got.id) {
				mmGetByPlaceID.t.Errorf("ThingTagRepositoryMock.GetByPlaceID got unexpected parameter id, want: %#v, got: %#v%s\n", *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id))
			}

		} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmGetByPlaceID.t.Errorf("ThingTagRepositoryMock.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 ThingTagRepositoryMock.GetByPlaceID")
		}
		return (*mm_results).ta1, (*mm_results).err
	}
	if mmGetByPlaceID.funcGetByPlaceID != nil {
		return mmGetByPlaceID.funcGetByPlaceID(ctx, id)
	}
	mmGetByPlaceID.t.Fatalf("Unexpected call to ThingTagRepositoryMock.GetByPlaceID. %v %v", ctx, id)
	return
}

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

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

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

	argCopy := make([]*ThingTagRepositoryMockGetByPlaceIDParams, 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 *ThingTagRepositoryMock) MinimockGetByPlaceIDDone() bool {
	if m.GetByPlaceIDMock.optional {
		// Optional methods provide '0 or more' call count restriction.
		return true
	}

	for _, e := range m.GetByPlaceIDMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	return m.GetByPlaceIDMock.invocationsDone()
}

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

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

	if !m.GetByPlaceIDMock.invocationsDone() && afterGetByPlaceIDCounter > 0 {
		m.t.Errorf("Expected %d calls to ThingTagRepositoryMock.GetByPlaceID but found %d calls",
			mm_atomic.LoadUint64(&m.GetByPlaceIDMock.expectedInvocations), afterGetByPlaceIDCounter)
	}
}

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

			m.MinimockGetByPlaceIDInspect()
		}
	})
}

// MinimockWait waits for all mocked methods to be called the expected number of times
func (m *ThingTagRepositoryMock) 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 *ThingTagRepositoryMock) minimockDone() bool {
	done := true
	return done &&
		m.MinimockDeleteByThingIDDone() &&
		m.MinimockGetByPlaceIDDone()
}
