package role

import "mini_server/internal/dao"

type RoleInfo struct {
	RoleId        uint64 `json:"role_id"`
	VoiceId       int    `json:"voice_id"`
	RoleName      string `json:"role_name"`
	WakeupWords   string `json:"wakeup_words"`
	WorldScenario string `json:"world_scenario"`
	Description   string `json:"description"`
	Emojis        string `json:"emojis"`
	Dialogues     string `json:"dialogues"`
	AvatarId      string `json:"avatar_id"`      /// 头像图片路径
	BackgroundIds string `json:"background_ids"` // 背景图列表，以逗号分隔
}

/*
type QueryURI struct {
	RoleId int32 `uri:"role_id" binding:"gt=0"`
}
type QueryReply struct {
	RoleInfo *RoleInfo `json:"role_info"`
}

// 单个角色查询接口

func Query(c *gin.Context) {
	reply := httpreply.NewDefaultReplyData()
	defer httpreply.Reply(c, reply)

	var param QueryURI
	if err := c.ShouldBindUri(&param); err != nil {
		reply.Status = http.StatusBadRequest
		reply.Message = fmt.Sprintf("invalid uri, err:%v", err)
		return
	}

	data, err := dao.Character_Query(param.RoleId)
	if err != nil {
		logrus.Errorf("dao.Character_Query return err:%v", err)
		reply.Status = http.StatusInternalServerError
		reply.Message = "查询角色信息失败"
		return
	}
	var queryReply QueryReply
	if data != nil {
		var detail RoleInfo
		Copy_mysql_data(data, &detail)
		queryReply.RoleInfo = &detail
	}
	reply.Data = &queryReply
}
*/

func Copy_mysql_data(data *dao.Character, detail *RoleInfo) {
	detail.BackgroundIds = data.BackgroundIds
	detail.AvatarId = data.AvatarId
	detail.RoleId = uint64(data.ID)
	detail.VoiceId = data.VoiceId
	detail.RoleName = data.Name
	detail.WakeupWords = data.WakeupWords
	detail.WorldScenario = data.WorldScenario
	detail.Description = data.Description
	detail.Emojis = data.Emojis
	detail.Dialogues = data.Dialogues
}
