// Code generated by eevee. DO NOT EDIT!

package repository

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

	"golang.org/x/xerrors"
)

type GroupMock struct {
	expect *GroupExpect
}

func (r *GroupMock) EXPECT() *GroupExpect {
	return r.expect
}

func NewGroupMock() *GroupMock {
	return &GroupMock{expect: NewGroupExpect()}
}

type GroupToModelExpect struct {
	expect        *GroupExpect
	isOutOfOrder  bool
	isAnyTimes    bool
	requiredTimes int
	calledTimes   int
	actions       []func(value *entity.Group)
	value         *entity.Group
	r0            *model.Group
}

func (r *GroupToModelExpect) Return(r0 *model.Group) *GroupToModelExpect {
	r.r0 = r0
	return r
}

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

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

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

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

func (r *GroupMock) ToModel(value *entity.Group) (r0 *model.Group) {
	if len(r.expect.toModel) == 0 {
		log.Printf("cannot find mock method for Group.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 Group value:[%+v]", value)
	return
}

func (r *GroupExpect) ToModel(value *entity.Group) *GroupToModelExpect {
	exp := &GroupToModelExpect{
		actions: []func(value *entity.Group){},
		expect:  r,
		value:   value,
	}
	r.toModel = append(r.toModel, exp)
	return exp
}

type GroupToModelsExpect struct {
	expect        *GroupExpect
	isOutOfOrder  bool
	isAnyTimes    bool
	requiredTimes int
	calledTimes   int
	actions       []func(values entity.Groups)
	values        entity.Groups
	r0            *model.Groups
}

func (r *GroupToModelsExpect) Return(r0 *model.Groups) *GroupToModelsExpect {
	r.r0 = r0
	return r
}

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

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

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

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

func (r *GroupMock) ToModels(values entity.Groups) (r0 *model.Groups) {
	if len(r.expect.toModels) == 0 {
		log.Printf("cannot find mock method for Group.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 Group values:[%+v]", values)
	return
}

func (r *GroupExpect) ToModels(values entity.Groups) *GroupToModelsExpect {
	exp := &GroupToModelsExpect{
		actions: []func(values entity.Groups){},
		expect:  r,
		values:  values,
	}
	r.toModels = append(r.toModels, exp)
	return exp
}

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

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

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

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

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

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

func (r *GroupMock) Create(ctx context.Context, value *entity.Group) (r0 *model.Group, r1 error) {
	if len(r.expect.create) == 0 {
		r1 = xerrors.New("cannot find mock method for Group.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 Group ctx:[%+v] value:[%+v]", ctx, value)
	return
}

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

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

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

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

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

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

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

func (r *GroupMock) Creates(ctx context.Context, entities entity.Groups) (r0 *model.Groups, r1 error) {
	if len(r.expect.creates) == 0 {
		r1 = xerrors.New("cannot find mock method for Group.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 Group ctx:[%+v] entities:[%+v]", ctx, entities)
	return
}

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

type GroupExpect struct {
	toModel  []*GroupToModelExpect
	toModels []*GroupToModelsExpect
	create   []*GroupCreateExpect
	creates  []*GroupCreatesExpect
}

func NewGroupExpect() *GroupExpect {
	return &GroupExpect{
		create:   []*GroupCreateExpect{},
		creates:  []*GroupCreatesExpect{},
		toModel:  []*GroupToModelExpect{},
		toModels: []*GroupToModelsExpect{},
	}
}
