package mongo_model

import (
	"time"
)

type AdvicerVersionMongo struct {
	AdvicerId          int32              `json:"advicerId" bson:"advicerId"`
	VersionDesc        string             `json:"versionDesc" bson:"versionDesc"`
	DialectFeatures    DialectFeatures    `json:"dialectFeatures" bson:"DialectFeatures"`
	SentencePatterns   SentencePatterns   `json:"sentencePatterns" bson:"sentencePatterns"`
	ToneTags           ToneTags           `json:"toneTags" bson:"toneTags"`
	PersonalityTags    PersonalityTags    `json:"personalityTags" bson:"personalityTags"`
	SignatureDialogues SignatureDialogues `json:"signatureDialogues" bson:"signatureDialogues"`
	LastUpdateTime     time.Time          `json:"lastUpdateTime" bson:"lastUpdateTime"`
}

func NewAdvicerVersionMongo() *AdvicerVersionMongo {
	return &AdvicerVersionMongo{}
}

func (a *AdvicerVersionMongo) MongoTableName() string {
	return "advicer_version"
}

type AdvicerVersionMongoEntity struct {
	DialectFeatures    DialectFeatures    `json:"dialectFeatures"`
	SentencePatterns   SentencePatterns   `json:"sentencePatterns"`
	ToneTags           ToneTags           `json:"toneTags"`
	PersonalityTags    PersonalityTags    `json:"personalityTags"`
	SignatureDialogues SignatureDialogues `json:"signatureDialogues"`
}

func (a *AdvicerVersionMongo) Entity() *AdvicerVersionMongoEntity {
	return &AdvicerVersionMongoEntity{
		DialectFeatures:    a.DialectFeatures,
		SentencePatterns:   a.SentencePatterns,
		ToneTags:           a.ToneTags,
		PersonalityTags:    a.PersonalityTags,
		SignatureDialogues: a.SignatureDialogues,
	}
}

// DialectFeatures 方言特征
type DialectFeatures struct {
	Region    string   `json:"region"`    //方言使用程度
	Intensity float64  `json:"intensity"` // 方言使用强度（0-1）
	KeyWords  []string `json:"keyWords"`
}

func (e *DialectFeatures) Example() string {
	return `{"region":"四川成都话","intensity":0.4,"keyWords":["噻","要得","没得","不晓得","是不是"]}`
}

func (e *DialectFeatures) Copy() AdviceData {
	return new(DialectFeatures)
}

func (e *DialectFeatures) Role() AdviceRole {
	return RoleAdvicer
}

func (e *DialectFeatures) Desc() string {
	return "方言特征"
}

// SentencePatterns 句子模式
type SentencePatterns struct {
	OpeningMode      []string `json:"openingMode"`      //开场模式
	ExplanationMode  []string `json:"explanationMode"`  //解释模式
	ConfirmationMode []string `json:"confirmationMode"` //确认模式
	SummaryMode      []string `json:"summaryMode"`      //总结模式
	TransitionMode   []string `json:"transitionMode"`   //过渡模式
}

func (e *SentencePatterns) Example() string {
	return `{"openingMode":["我给你介绍一下","我们先来看一下"],"explanationMode":["是这样的","我跟你讲","你发现没得"],"confirmationMode":["对吧？","是不是嘛？","你晓得不？","明白了噻？"],"summaryMode":["所以说","简单说就是"],"transitionMode":["然后的话","再其次","还有一点"]}`
}

func (e *SentencePatterns) Copy() AdviceData {
	return new(SentencePatterns)
}

func (e *SentencePatterns) Role() AdviceRole {
	return RoleAdvicer
}

func (e *SentencePatterns) Desc() string {
	return "句子模式"
}

// PersonalityTags 个性标签
type PersonalityTags []string

func (e *PersonalityTags) Example() string {
	return `["耐心细致","细节控"]`
}
func (e *PersonalityTags) Copy() AdviceData {
	return new(PersonalityTags)
}

func (e *PersonalityTags) Role() AdviceRole {
	return RoleAdvicer
}

func (e *PersonalityTags) Desc() string {
	return "个性标签"
}

// ToneTags 语气标签
type ToneTags struct {
	Enthusiasm   float64 `json:"enthusiasm"`
	Patience     float64 `json:"patience"`
	Confidence   float64 `json:"confidence"`
	Friendliness float64 `json:"friendliness"`
	Persuasion   float64 `json:"persuasion"`
}

func (e *ToneTags) Example() string {
	return `{"enthusiasm":0.8,"patience":0.9,"confidence":0.85,"friendliness":0.75,"persuasion":0.7}`
}

func (e *ToneTags) Copy() AdviceData {
	return new(ToneTags)
}

func (e *ToneTags) Role() AdviceRole {
	return RoleAdvicer
}

func (e *ToneTags) Desc() string {
	return "语气标签"
}

// SignatureDialogues 代表性对话示例
type SignatureDialogues []struct {
	Context  string `json:"context"`
	Dialogue string `json:"dialogue"` //解释
}

func (e *SignatureDialogues) Example() string {
	return `[{"context":"客户质疑地块大小","dialogue":"哥，14亩确实不大，但你要在成都是2.5环内城买房，这种是个普遍存在的一个现象。你看万景和绿城都是13亩，中铁建只有8.8亩，339那个帮泰只有11亩。我们虽然地小，但楼间距开阔啊，看过去都是200多米！"},{"context":"客户担心物业费高","dialogue":"姐，我懂你意思，我们也觉得物业费是有点贵。但招商物业是铂金服务，有管家送外卖、免费宠物喂养这些增值服务。你算一下，就算贵一块钱，十年也就多14000，但好物业让房子增值不止这点！"},{"context":"客户犹豫价格","dialogue":"说实话，这个地段的地价都比28板块贵5000多，但我们单价只贵3000。你看龙湖滨江云河颂套内单价都36000了，我们才33000，真的性价比高！现在不买，以后这个板块可能就买不起了。"}]`
}

func (e *SignatureDialogues) Copy() AdviceData {
	return new(SignatureDialogues)
}

func (e *SignatureDialogues) Role() AdviceRole {
	return RoleAdvicer
}

func (e *SignatureDialogues) Desc() string {
	return "代表性对话示例"
}
