///////////////////////////////////////////////////////////
// THIS FILE IS AUTO GENERATED by gormgen, DON'T EDIT IT //
//        ANY CHANGES DONE HERE WILL BE LOST             //
///////////////////////////////////////////////////////////

package sms_coupon

import (
	"fmt"
	"time"

	"github.com/pkg/errors"
	"gorm.io/gorm"

	"github.com/ChangSZ/mall-go/internal/repository/mysql"
)

func NewModel() *SmsCoupon {
	return new(SmsCoupon)
}

func NewQueryBuilder() *smsCouponQueryBuilder {
	return new(smsCouponQueryBuilder)
}

func (t *SmsCoupon) Create(db *gorm.DB) (id int64, err error) {
	if err = db.Create(t).Error; err != nil {
		return 0, errors.Wrap(err, "create err")
	}
	return t.Id, nil
}

type smsCouponQueryBuilder struct {
	order []string
	where []struct {
		prefix string
		value  interface{}
	}
	limit  int
	offset int
}

func (qb *smsCouponQueryBuilder) buildQuery(db *gorm.DB) *gorm.DB {
	ret := db
	for _, where := range qb.where {
		ret = ret.Where(where.prefix, where.value)
	}
	for _, order := range qb.order {
		ret = ret.Order(order)
	}
	if qb.limit != 0 {
		ret = ret.Limit(qb.limit)
	}
	ret = ret.Offset(qb.offset)
	return ret
}

func (qb *smsCouponQueryBuilder) Updates(db *gorm.DB, m map[string]interface{}) (int64, error) {
	db = db.Model(&SmsCoupon{})

	for _, where := range qb.where {
		db.Where(where.prefix, where.value)
	}

	ret := db.Updates(m)
	err := ret.Error
	if err != nil {
		return 0, errors.Wrap(err, "updates err")
	}
	return ret.RowsAffected, nil
}

func (qb *smsCouponQueryBuilder) Delete(db *gorm.DB) (int64, error) {
	for _, where := range qb.where {
		db = db.Where(where.prefix, where.value)
	}

	ret := db.Delete(&SmsCoupon{})
	err := ret.Error
	if err != nil {
		return 0, errors.Wrap(err, "delete err")
	}
	return ret.RowsAffected, nil
}

func (qb *smsCouponQueryBuilder) Count(db *gorm.DB) (int64, error) {
	var c int64
	res := qb.buildQuery(db).Model(&SmsCoupon{}).Count(&c)
	if res.Error != nil && res.Error == gorm.ErrRecordNotFound {
		return 0, nil
	}
	return c, res.Error
}

func (qb *smsCouponQueryBuilder) First(db *gorm.DB) (*SmsCoupon, error) {
	ret := &SmsCoupon{}
	res := qb.buildQuery(db).First(ret)
	if res.Error != nil && res.Error == gorm.ErrRecordNotFound {
		return nil, nil
	}
	return ret, res.Error
}

func (qb *smsCouponQueryBuilder) QueryOne(db *gorm.DB) (*SmsCoupon, error) {
	qb.limit = 1
	ret, err := qb.QueryAll(db)
	if len(ret) > 0 {
		return ret[0], err
	}
	return nil, err
}

func (qb *smsCouponQueryBuilder) QueryAll(db *gorm.DB) ([]*SmsCoupon, error) {
	var ret []*SmsCoupon
	err := qb.buildQuery(db).Find(&ret).Error
	return ret, err
}

func (qb *smsCouponQueryBuilder) Limit(limit int) *smsCouponQueryBuilder {
	qb.limit = limit
	return qb
}

func (qb *smsCouponQueryBuilder) Offset(offset int) *smsCouponQueryBuilder {
	qb.offset = offset
	return qb
}

func (qb *smsCouponQueryBuilder) WhereId(p mysql.Predicate, value int64) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "id", p),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereIdIn(value []int64) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "id", "IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereIdNotIn(value []int64) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "id", "NOT IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) OrderById(asc bool) *smsCouponQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "id "+order)
	return qb
}

func (qb *smsCouponQueryBuilder) WhereType(p mysql.Predicate, value int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "type", p),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereTypeIn(value []int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "type", "IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereTypeNotIn(value []int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "type", "NOT IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) OrderByType(asc bool) *smsCouponQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "type "+order)
	return qb
}

func (qb *smsCouponQueryBuilder) WhereName(p mysql.Predicate, value string) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "name", p),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereNameIn(value []string) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "name", "IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereNameNotIn(value []string) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "name", "NOT IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) OrderByName(asc bool) *smsCouponQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "name "+order)
	return qb
}

func (qb *smsCouponQueryBuilder) WherePlatform(p mysql.Predicate, value int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "platform", p),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WherePlatformIn(value []int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "platform", "IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WherePlatformNotIn(value []int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "platform", "NOT IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) OrderByPlatform(asc bool) *smsCouponQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "platform "+order)
	return qb
}

func (qb *smsCouponQueryBuilder) WhereCount(p mysql.Predicate, value int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "count", p),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereCountIn(value []int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "count", "IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereCountNotIn(value []int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "count", "NOT IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) OrderByCount(asc bool) *smsCouponQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "count "+order)
	return qb
}

func (qb *smsCouponQueryBuilder) WhereAmount(p mysql.Predicate, value float64) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "amount", p),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereAmountIn(value []float64) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "amount", "IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereAmountNotIn(value []float64) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "amount", "NOT IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) OrderByAmount(asc bool) *smsCouponQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "amount "+order)
	return qb
}

func (qb *smsCouponQueryBuilder) WherePerLimit(p mysql.Predicate, value int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "per_limit", p),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WherePerLimitIn(value []int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "per_limit", "IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WherePerLimitNotIn(value []int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "per_limit", "NOT IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) OrderByPerLimit(asc bool) *smsCouponQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "per_limit "+order)
	return qb
}

func (qb *smsCouponQueryBuilder) WhereMinPoint(p mysql.Predicate, value float64) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "min_point", p),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereMinPointIn(value []float64) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "min_point", "IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereMinPointNotIn(value []float64) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "min_point", "NOT IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) OrderByMinPoint(asc bool) *smsCouponQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "min_point "+order)
	return qb
}

func (qb *smsCouponQueryBuilder) WhereStartTime(p mysql.Predicate, value time.Time) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "start_time", p),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereStartTimeIn(value []time.Time) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "start_time", "IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereStartTimeNotIn(value []time.Time) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "start_time", "NOT IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) OrderByStartTime(asc bool) *smsCouponQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "start_time "+order)
	return qb
}

func (qb *smsCouponQueryBuilder) WhereEndTime(p mysql.Predicate, value time.Time) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "end_time", p),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereEndTimeIn(value []time.Time) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "end_time", "IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereEndTimeNotIn(value []time.Time) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "end_time", "NOT IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) OrderByEndTime(asc bool) *smsCouponQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "end_time "+order)
	return qb
}

func (qb *smsCouponQueryBuilder) WhereUseType(p mysql.Predicate, value int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "use_type", p),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereUseTypeIn(value []int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "use_type", "IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereUseTypeNotIn(value []int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "use_type", "NOT IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) OrderByUseType(asc bool) *smsCouponQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "use_type "+order)
	return qb
}

func (qb *smsCouponQueryBuilder) WhereNote(p mysql.Predicate, value string) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "note", p),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereNoteIn(value []string) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "note", "IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereNoteNotIn(value []string) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "note", "NOT IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) OrderByNote(asc bool) *smsCouponQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "note "+order)
	return qb
}

func (qb *smsCouponQueryBuilder) WherePublishCount(p mysql.Predicate, value int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "publish_count", p),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WherePublishCountIn(value []int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "publish_count", "IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WherePublishCountNotIn(value []int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "publish_count", "NOT IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) OrderByPublishCount(asc bool) *smsCouponQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "publish_count "+order)
	return qb
}

func (qb *smsCouponQueryBuilder) WhereUseCount(p mysql.Predicate, value int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "use_count", p),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereUseCountIn(value []int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "use_count", "IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereUseCountNotIn(value []int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "use_count", "NOT IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) OrderByUseCount(asc bool) *smsCouponQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "use_count "+order)
	return qb
}

func (qb *smsCouponQueryBuilder) WhereReceiveCount(p mysql.Predicate, value int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "receive_count", p),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereReceiveCountIn(value []int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "receive_count", "IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereReceiveCountNotIn(value []int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "receive_count", "NOT IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) OrderByReceiveCount(asc bool) *smsCouponQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "receive_count "+order)
	return qb
}

func (qb *smsCouponQueryBuilder) WhereEnableTime(p mysql.Predicate, value time.Time) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "enable_time", p),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereEnableTimeIn(value []time.Time) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "enable_time", "IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereEnableTimeNotIn(value []time.Time) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "enable_time", "NOT IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) OrderByEnableTime(asc bool) *smsCouponQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "enable_time "+order)
	return qb
}

func (qb *smsCouponQueryBuilder) WhereCode(p mysql.Predicate, value string) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "code", p),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereCodeIn(value []string) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "code", "IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereCodeNotIn(value []string) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "code", "NOT IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) OrderByCode(asc bool) *smsCouponQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "code "+order)
	return qb
}

func (qb *smsCouponQueryBuilder) WhereMemberLevel(p mysql.Predicate, value int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "member_level", p),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereMemberLevelIn(value []int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "member_level", "IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) WhereMemberLevelNotIn(value []int32) *smsCouponQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "member_level", "NOT IN"),
		value,
	})
	return qb
}

func (qb *smsCouponQueryBuilder) OrderByMemberLevel(asc bool) *smsCouponQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "member_level "+order)
	return qb
}
