// Code generated by gtag. DO NOT EDIT.
// See: https://github.com/wolfogre/gtag

//go:generate go run github.com/wolfogre/gtag/cmd/gtag -types Book -tags bson .
package domain

import (
	"reflect"
	"strings"
)

var (
	valueOfBook = Book{}
	typeOfBook  = reflect.TypeOf(valueOfBook)

	_                = valueOfBook.ID
	fieldOfBookID, _ = typeOfBook.FieldByName("ID")
	tagOfBookID      = fieldOfBookID.Tag

	_                  = valueOfBook.Name
	fieldOfBookName, _ = typeOfBook.FieldByName("Name")
	tagOfBookName      = fieldOfBookName.Tag

	_                  = valueOfBook.Type
	fieldOfBookType, _ = typeOfBook.FieldByName("Type")
	tagOfBookType      = fieldOfBookType.Tag

	_                    = valueOfBook.Banner
	fieldOfBookBanner, _ = typeOfBook.FieldByName("Banner")
	tagOfBookBanner      = fieldOfBookBanner.Tag

	_                       = valueOfBook.CrtUserId
	fieldOfBookCrtUserId, _ = typeOfBook.FieldByName("CrtUserId")
	tagOfBookCrtUserId      = fieldOfBookCrtUserId.Tag

	_                     = valueOfBook.CrtTime
	fieldOfBookCrtTime, _ = typeOfBook.FieldByName("CrtTime")
	tagOfBookCrtTime      = fieldOfBookCrtTime.Tag

	_                     = valueOfBook.UpdTime
	fieldOfBookUpdTime, _ = typeOfBook.FieldByName("UpdTime")
	tagOfBookUpdTime      = fieldOfBookUpdTime.Tag

	_                   = valueOfBook.Users
	fieldOfBookUsers, _ = typeOfBook.FieldByName("Users")
	tagOfBookUsers      = fieldOfBookUsers.Tag

	_                       = valueOfBook.IsInitial
	fieldOfBookIsInitial, _ = typeOfBook.FieldByName("IsInitial")
	tagOfBookIsInitial      = fieldOfBookIsInitial.Tag
)

// BookTags indicate tags of type Book
type BookTags struct {
	ID        string // `bson:"_id,omitempty" json:"_id"`
	Name      string // `bson:"name" json:"name"`
	Type      string // `bson:"type" json:"type"`
	Banner    string // `bson:"banner" json:"banner"`
	CrtUserId string // `bson:"crt_user_id" json:"crt_user_id"`
	CrtTime   string // `bson:"crt_time" json:"crt_time"`
	UpdTime   string // `bson:"upd_time" json:"upd_time"`
	Users     string // `bson:"users" json:"users"`
	IsInitial string // `bson:"is_initial" json:"is_initial"`
}

// Values return all tags of Book as slice
func (t *BookTags) Values() []string {
	return []string{
		t.ID,
		t.Name,
		t.Type,
		t.Banner,
		t.CrtUserId,
		t.CrtTime,
		t.UpdTime,
		t.Users,
		t.IsInitial,
	}
}

// Tags return specified tags of Book
func (*Book) Tags(tag string, convert ...func(string) string) BookTags {
	conv := func(in string) string { return strings.TrimSpace(strings.Split(in, ",")[0]) }
	if len(convert) > 0 {
		conv = convert[0]
	}
	if conv == nil {
		conv = func(in string) string { return in }
	}
	return BookTags{
		ID:        conv(tagOfBookID.Get(tag)),
		Name:      conv(tagOfBookName.Get(tag)),
		Type:      conv(tagOfBookType.Get(tag)),
		Banner:    conv(tagOfBookBanner.Get(tag)),
		CrtUserId: conv(tagOfBookCrtUserId.Get(tag)),
		CrtTime:   conv(tagOfBookCrtTime.Get(tag)),
		UpdTime:   conv(tagOfBookUpdTime.Get(tag)),
		Users:     conv(tagOfBookUsers.Get(tag)),
		IsInitial: conv(tagOfBookIsInitial.Get(tag)),
	}
}

// TagsBson is alias of Tags("bson")
func (*Book) TagsBson() BookTags {
	var v *Book
	return v.Tags("bson")
}
