package mongo_model

import (
	"time"
)

type AdvicerChatHisMongo struct {
	SessionId string    `json:"sessionId" bson:"sessionId"`
	User      string    `json:"User" bson:"User"`
	Assistant Assistant `json:"assistant" bson:"assistant"`
	InToken   int64     `json:"inToken" bson:"inToken"`
	OutToken  int64     `json:"outToken" bson:"outToken"`
	CreatAt   time.Time `json:"creatAt" bson:"creatAt"`
}

func NewAdvicerChatHisMongo() *AdvicerChatHisMongo {
	return &AdvicerChatHisMongo{}
}

func (a *AdvicerChatHisMongo) MongoTableName() string {
	return "advicer_chat_his"
}

type AdvicerChatHisMongoEntity struct {
	User          string `json:"user"`
	Assistant     string `json:"assistant"`
	MissionStatus string `json:"missionStatus"`
	MissionNext   string `json:"missionNext"`
	CreateAt      string `json:"createAt"`
}

func (a *AdvicerChatHisMongo) Entity() AdvicerChatHisMongoEntity {
	return AdvicerChatHisMongoEntity{
		User:          a.User,
		Assistant:     a.Assistant.Result,
		MissionStatus: a.Assistant.MissionStatus,
		MissionNext:   a.Assistant.MissionCompleteDesc,
		CreateAt:      a.CreatAt.Format(time.DateTime),
	}
}

type Assistant struct {
	Result              string `json:"result"`
	MissionStatus       string `json:"mission_status"`
	MissionCompleteDesc string `json:"mission_complete_desc"`
}
