package model

import (
	"blazing/cool"
)

const TableNameSoulOrb = "soul_orb"

// SoulOrb mapped from table <soul_orb>
type SoulOrb struct {
	*cool.Model
	PlayerID uint64 `gorm:"not null;index:idx_soul_orb_by_player_id;comment:'所属玩家ID'" json:"player_id"`
	Data     string `gorm:"type:text;not null;comment:'全部数据'" json:"data"`
}

type SoulInfo struct {
	ItemID           int64  `gorm:"not null;comment:'对应物品ID'" json:"item_id"`
	ObtainTime       int64  `gorm:"not null;comment:'捕获时间(时间戳)'" json:"obtain_time"`
	StartHatchTime   string `gorm:"comment:'开始孵化时间'" json:"start_hatch_time"`
	HatchTime        int32  `gorm:"not null;default:0;comment:'剩余孵化时间(秒)'" json:"hatch_time"`
	PetTypeID        int32  `gorm:"not null;comment:'精灵类型ID/精灵图鉴ID'" json:"pet_type_id"`
	IndividualValue  int16  `gorm:"not null;comment:'个体值(DV)'" json:"individual_value"`
	Nature           int16  `gorm:"not null;comment:'性格类型'" json:"nature"`
	AbilityTypeEnum  int16  `gorm:"comment:'特性枚举'" json:"ability_type_enum"`
	Shiny            int32  `gorm:"not null;default:0;comment:'是否为闪光宠物(1=是，0=否)'" json:"shiny"`
	Level            int16  `gorm:"not null;default:1;comment:'当前等级'" json:"level"`
	CurrentExp       int32  `gorm:"not null;default:0;comment:'当前等级已获得经验值'" json:"current_exp"`
	EvHP             int16  `gorm:"not null;default:0;comment:'生命值学习力'" json:"ev_hp"`
	EvAttack         int16  `gorm:"not null;default:0;comment:'攻击学习力'" json:"ev_attack"`
	EvDefense        int16  `gorm:"not null;default:0;comment:'防御学习力'" json:"ev_defense"`
	EvSpecialAttack  int16  `gorm:"not null;default:0;comment:'特殊攻击学习力'" json:"ev_special_attack"`
	EvSpecialDefense int16  `gorm:"not null;default:0;comment:'特殊防御学习力'" json:"ev_special_defense"`
	EvSpeed          int16  `gorm:"not null;default:0;comment:'速度学习力'" json:"ev_speed"`
}

// TableName SoulOrb's table name
func (*SoulOrb) TableName() string {
	return TableNameSoulOrb
}

// GroupName SoulOrb's table group
func (*SoulOrb) GroupName() string {
	return "default"
}

// NewSoulOrb create a new SoulOrb
func NewSoulOrb() *SoulOrb {
	return &SoulOrb{
		Model: cool.NewModel(),
	}
}

// init 创建表
func init() {
	cool.CreateTable(&SoulOrb{})
}
