package mongo_model

import (
	"time"
)

type AdvicerClientMongo struct {
	ProjectId       int32           `json:"projectId" bson:"projectId"`
	AdvicerId       int32           `json:"advicerId" bson:"advicerId"`
	PersonalInfo    PersonalInfo    `json:"personalInfo" bson:"personalInfo"`
	PurchasePurpose PurchasePurpose `json:"purchasePurpose" bson:"purchasePurpose"`
	CoreDemands     CoreDemands     `json:"coreDemands" bson:"coreDemands"`
	Concerns        []string        `json:"concerns" bson:"concerns"`
	DecisionProfile []string        `json:"decisionProfile" bson:"decisionProfile"`
	LastUpdateTime  time.Time       `json:"lastUpdateTime" bson:"lastUpdateTime"`
}

func NewAdvicerClientMongo() *AdvicerClientMongo {
	return &AdvicerClientMongo{}
}

func (a *AdvicerClientMongo) MongoTableName() string {
	return "advicer_client"
}

type AdvicerClientMongoEntity struct {
	PersonalInfo    PersonalInfo    `json:"personalInfo"`
	PurchasePurpose PurchasePurpose `json:"purchasePurpose"`
	CoreDemands     CoreDemands     `json:"coreDemands"`
	Concerns        []string        `json:"concerns"`
	DecisionProfile []string        `json:"decisionProfile"`
}

func (a *AdvicerClientMongo) Entity() *AdvicerClientMongoEntity {
	return &AdvicerClientMongoEntity{
		PersonalInfo:    a.PersonalInfo,
		PurchasePurpose: a.PurchasePurpose,
		CoreDemands:     a.CoreDemands,
		Concerns:        a.Concerns,
		DecisionProfile: a.DecisionProfile,
	}
}

// Customer  客户信息
type Customer []ClientInfo
type ClientInfo struct {
	// 个人信息
	PersonalInfo PersonalInfo `json:"personalInfo"`

	// 购房目的
	PurchasePurpose PurchasePurpose `json:"purchasePurpose"`

	// 核心需求
	CoreDemands CoreDemands `json:"coreDemands"`

	// 关注点与顾虑
	Concerns []string `json:"concerns"`

	// 决策建议
	DecisionProfile []string `json:"decisionProfile"`
}

type PersonalInfo struct {
	Name           string `json:"name"`           // 姓氏
	Gender         string `json:"gender"`         // 性别
	Location       string `json:"location"`       // 来源地/当前居住地
	IsFirstHome    bool   `json:"isFirstHome"`    // 是否首套房
	FamilyOrganize string `json:"familyOrganize"` // 家庭人数
}

type PurchasePurpose struct {
	PrimaryPurpose   string `json:"primaryPurpose"`   // 主要目的
	SecondaryPurpose string `json:"secondaryPurpose"` // 次要目的
	DecisionMakers   string `json:"decisionMakers"`   // 决策人
}

type CoreDemands struct {
	TotalBudget     string `json:"totalBudget"`     // 预算范围
	PreferredLayout string `json:"preferredLayout"` // 偏好户型
	CoreAppeal      string `json:"coreAppeal"`      // 核心述求
}

func (e *Customer) Example() string {
	return `[{"personalInfo":{"name":"唐","gender":"男","location":"成都北门","isFirstHome":true,"familyOrganize":"夫妻"},"purchasePurpose":{"primaryPurpose":"首次置业，解决自住","secondaryPurpose":"资产保值，未来可出租","decisionMakers":"夫妻双方"},"coreDemands":{"totalBudget":"350-400"","preferredLayout":"118㎡四房三卫双套房","coreAppeal":"在有限预算内满足家庭居住功能，确保房产保值"},"concerns":["总价超预算风险","板块保值能力"],"decisionProfile":["预算导向，严格控制总价","重点关注户型功能性和实用性"]},{"personalInfo":{"name":"冯女士","gender":"女","location":"","isFirstHome":false,"familyOrganize":"夫妻+1孩+父母同住"},"purchasePurpose":{"primaryPurpose":"改善居住条件","secondaryPurpose":"子女教育质量提升","decisionMakers":"夫妻双方需家庭共同商议]},"coreDemands":{"totalBudget":"400-500","preferredLayout":"118㎡四房三卫（非全景户型）","coreAppeal":"安静舒适、学区有保障的改善型住房"},"concerns":["临路噪音影响老人休息","学区质量和稳定性","社区小，绿化空间有限","得房率是否足够","二八板块学区对比"],"decisionProfile":["对噪音敏感，需要安静环境","重视教育资源配置","关注社区品质和舒适度","需要详细对比不同板块学区优势"]}]`
}

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

func (e *Customer) Role() AdviceRole {
	return RoleClient
}

func (e *Customer) Desc() string {
	return "客户信息"
}
