// Code generated by eevee. DO NOT EDIT!

package repository

import (
	"/entity"
	"/model"
	"context"
	"log"
	"reflect"

	"golang.org/x/xerrors"
)

type FieldMock struct {
	expect *FieldExpect
}

func (r *FieldMock) EXPECT() *FieldExpect {
	return r.expect
}

func NewFieldMock() *FieldMock {
	return &FieldMock{expect: NewFieldExpect()}
}

type FieldToModelExpect struct {
	expect        *FieldExpect
	isOutOfOrder  bool
	isAnyTimes    bool
	requiredTimes int
	calledTimes   int
	actions       []func(value *entity.Field)
	value         *entity.Field
	r0            *model.Field
}

func (r *FieldToModelExpect) Return(r0 *model.Field) *FieldToModelExpect {
	r.r0 = r0
	return r
}

func (r *FieldToModelExpect) Do(action func(value *entity.Field)) *FieldToModelExpect {
	r.actions = append(r.actions, action)
	return r
}

func (r *FieldToModelExpect) OutOfOrder() *FieldToModelExpect {
	r.isOutOfOrder = true
	return r
}

func (r *FieldToModelExpect) AnyTimes() *FieldToModelExpect {
	r.isAnyTimes = true
	return r
}

func (r *FieldToModelExpect) Times(n int) *FieldToModelExpect {
	r.requiredTimes = n
	return r
}

func (r *FieldMock) ToModel(value *entity.Field) (r0 *model.Field) {
	if len(r.expect.toModel) == 0 {
		log.Printf("cannot find mock method for Field.ToModel")
		return
	}
	for _, exp := range r.expect.toModel {
		if !reflect.DeepEqual(exp.value, value) {
			continue
		}
		for _, action := range exp.actions {
			action(value)
		}
		if exp.isAnyTimes {
			r0 = exp.r0
			return
		}
		if exp.requiredTimes > 1 && exp.calledTimes > exp.requiredTimes {
			log.Printf("invalid call times. requiredTimes: [%d] calledTimes: [%d]", exp.requiredTimes, exp.calledTimes)
			return
		}
		exp.calledTimes++
		r0 = exp.r0
		return
	}
	log.Printf("invalid argument Field value:[%+v]", value)
	return
}

func (r *FieldExpect) ToModel(value *entity.Field) *FieldToModelExpect {
	exp := &FieldToModelExpect{
		actions: []func(value *entity.Field){},
		expect:  r,
		value:   value,
	}
	r.toModel = append(r.toModel, exp)
	return exp
}

type FieldToModelsExpect struct {
	expect        *FieldExpect
	isOutOfOrder  bool
	isAnyTimes    bool
	requiredTimes int
	calledTimes   int
	actions       []func(values entity.Fields)
	values        entity.Fields
	r0            *model.Fields
}

func (r *FieldToModelsExpect) Return(r0 *model.Fields) *FieldToModelsExpect {
	r.r0 = r0
	return r
}

func (r *FieldToModelsExpect) Do(action func(values entity.Fields)) *FieldToModelsExpect {
	r.actions = append(r.actions, action)
	return r
}

func (r *FieldToModelsExpect) OutOfOrder() *FieldToModelsExpect {
	r.isOutOfOrder = true
	return r
}

func (r *FieldToModelsExpect) AnyTimes() *FieldToModelsExpect {
	r.isAnyTimes = true
	return r
}

func (r *FieldToModelsExpect) Times(n int) *FieldToModelsExpect {
	r.requiredTimes = n
	return r
}

func (r *FieldMock) ToModels(values entity.Fields) (r0 *model.Fields) {
	if len(r.expect.toModels) == 0 {
		log.Printf("cannot find mock method for Field.ToModels")
		return
	}
	for _, exp := range r.expect.toModels {
		if !reflect.DeepEqual(exp.values, values) {
			continue
		}
		for _, action := range exp.actions {
			action(values)
		}
		if exp.isAnyTimes {
			r0 = exp.r0
			return
		}
		if exp.requiredTimes > 1 && exp.calledTimes > exp.requiredTimes {
			log.Printf("invalid call times. requiredTimes: [%d] calledTimes: [%d]", exp.requiredTimes, exp.calledTimes)
			return
		}
		exp.calledTimes++
		r0 = exp.r0
		return
	}
	log.Printf("invalid argument Field values:[%+v]", values)
	return
}

func (r *FieldExpect) ToModels(values entity.Fields) *FieldToModelsExpect {
	exp := &FieldToModelsExpect{
		actions: []func(values entity.Fields){},
		expect:  r,
		values:  values,
	}
	r.toModels = append(r.toModels, exp)
	return exp
}

type FieldCreateExpect struct {
	expect        *FieldExpect
	isOutOfOrder  bool
	isAnyTimes    bool
	requiredTimes int
	calledTimes   int
	actions       []func(ctx context.Context, value *entity.Field)
	ctx           context.Context
	value         *entity.Field
	r0            *model.Field
	r1            error
}

func (r *FieldCreateExpect) Return(r0 *model.Field, r1 error) *FieldCreateExpect {
	r.r0 = r0
	r.r1 = r1
	return r
}

func (r *FieldCreateExpect) Do(action func(ctx context.Context, value *entity.Field)) *FieldCreateExpect {
	r.actions = append(r.actions, action)
	return r
}

func (r *FieldCreateExpect) OutOfOrder() *FieldCreateExpect {
	r.isOutOfOrder = true
	return r
}

func (r *FieldCreateExpect) AnyTimes() *FieldCreateExpect {
	r.isAnyTimes = true
	return r
}

func (r *FieldCreateExpect) Times(n int) *FieldCreateExpect {
	r.requiredTimes = n
	return r
}

func (r *FieldMock) Create(ctx context.Context, value *entity.Field) (r0 *model.Field, r1 error) {
	if len(r.expect.create) == 0 {
		r1 = xerrors.New("cannot find mock method for Field.Create")
		return
	}
	for _, exp := range r.expect.create {
		if !reflect.DeepEqual(exp.ctx, ctx) {
			continue
		}
		if !reflect.DeepEqual(exp.value, value) {
			continue
		}
		for _, action := range exp.actions {
			action(ctx, value)
		}
		if exp.isAnyTimes {
			r0 = exp.r0
			r1 = exp.r1
			return
		}
		if exp.requiredTimes > 1 && exp.calledTimes > exp.requiredTimes {
			r1 = xerrors.Errorf("invalid call times. requiredTimes: [%d] calledTimes: [%d]", exp.requiredTimes, exp.calledTimes)
			return
		}
		exp.calledTimes++
		r0 = exp.r0
		r1 = exp.r1
		return
	}
	r1 = xerrors.Errorf("invalid argument Field ctx:[%+v] value:[%+v]", ctx, value)
	return
}

func (r *FieldExpect) Create(ctx context.Context, value *entity.Field) *FieldCreateExpect {
	exp := &FieldCreateExpect{
		actions: []func(ctx context.Context, value *entity.Field){},
		ctx:     ctx,
		expect:  r,
		value:   value,
	}
	r.create = append(r.create, exp)
	return exp
}

type FieldCreatesExpect struct {
	expect        *FieldExpect
	isOutOfOrder  bool
	isAnyTimes    bool
	requiredTimes int
	calledTimes   int
	actions       []func(ctx context.Context, entities entity.Fields)
	ctx           context.Context
	entities      entity.Fields
	r0            *model.Fields
	r1            error
}

func (r *FieldCreatesExpect) Return(r0 *model.Fields, r1 error) *FieldCreatesExpect {
	r.r0 = r0
	r.r1 = r1
	return r
}

func (r *FieldCreatesExpect) Do(action func(ctx context.Context, entities entity.Fields)) *FieldCreatesExpect {
	r.actions = append(r.actions, action)
	return r
}

func (r *FieldCreatesExpect) OutOfOrder() *FieldCreatesExpect {
	r.isOutOfOrder = true
	return r
}

func (r *FieldCreatesExpect) AnyTimes() *FieldCreatesExpect {
	r.isAnyTimes = true
	return r
}

func (r *FieldCreatesExpect) Times(n int) *FieldCreatesExpect {
	r.requiredTimes = n
	return r
}

func (r *FieldMock) Creates(ctx context.Context, entities entity.Fields) (r0 *model.Fields, r1 error) {
	if len(r.expect.creates) == 0 {
		r1 = xerrors.New("cannot find mock method for Field.Creates")
		return
	}
	for _, exp := range r.expect.creates {
		if !reflect.DeepEqual(exp.ctx, ctx) {
			continue
		}
		if !reflect.DeepEqual(exp.entities, entities) {
			continue
		}
		for _, action := range exp.actions {
			action(ctx, entities)
		}
		if exp.isAnyTimes {
			r0 = exp.r0
			r1 = exp.r1
			return
		}
		if exp.requiredTimes > 1 && exp.calledTimes > exp.requiredTimes {
			r1 = xerrors.Errorf("invalid call times. requiredTimes: [%d] calledTimes: [%d]", exp.requiredTimes, exp.calledTimes)
			return
		}
		exp.calledTimes++
		r0 = exp.r0
		r1 = exp.r1
		return
	}
	r1 = xerrors.Errorf("invalid argument Field ctx:[%+v] entities:[%+v]", ctx, entities)
	return
}

func (r *FieldExpect) Creates(ctx context.Context, entities entity.Fields) *FieldCreatesExpect {
	exp := &FieldCreatesExpect{
		actions:  []func(ctx context.Context, entities entity.Fields){},
		ctx:      ctx,
		entities: entities,
		expect:   r,
	}
	r.creates = append(r.creates, exp)
	return exp
}

type FieldExpect struct {
	toModel  []*FieldToModelExpect
	toModels []*FieldToModelsExpect
	create   []*FieldCreateExpect
	creates  []*FieldCreatesExpect
}

func NewFieldExpect() *FieldExpect {
	return &FieldExpect{
		create:   []*FieldCreateExpect{},
		creates:  []*FieldCreatesExpect{},
		toModel:  []*FieldToModelExpect{},
		toModels: []*FieldToModelsExpect{},
	}
}
