package entity

const CollectionName = "copy_missions"

type Status string

const (
	StatusOpen     Status = "open"
	StatusMapped   Status = "mapped"
	StatusScanned  Status = "scanned"
	StatusDrafted  Status = "drafted"
	StatusArchived Status = "archived"
	StatusDeleted  Status = "deleted"
)

type SuggestedTag struct {
	Tag          string `bson:"tag" json:"tag"`
	Reason       string `bson:"reason,omitempty" json:"reason,omitempty"`
	SearchIntent string `bson:"search_intent,omitempty" json:"search_intent,omitempty"`
	SearchType   string `bson:"search_type,omitempty" json:"search_type,omitempty"`
}

type SimilarAccount struct {
	Username        string `bson:"username" json:"username"`
	Reason          string `bson:"reason,omitempty" json:"reason,omitempty"`
	Source          string `bson:"source,omitempty" json:"source,omitempty"`
	Confidence      string `bson:"confidence,omitempty" json:"confidence,omitempty"`
	ProfileURL      string `bson:"profile_url,omitempty" json:"profile_url,omitempty"`
	AuthorVerified  bool   `bson:"author_verified,omitempty" json:"author_verified,omitempty"`
	FollowerCount   int    `bson:"follower_count,omitempty" json:"follower_count,omitempty"`
	EngagementScore int    `bson:"engagement_score,omitempty" json:"engagement_score,omitempty"`
	LikeCount       int    `bson:"like_count,omitempty" json:"like_count,omitempty"`
	ReplyCount      int    `bson:"reply_count,omitempty" json:"reply_count,omitempty"`
	PostCount       int    `bson:"post_count,omitempty" json:"post_count,omitempty"`
}

type ResearchMap struct {
	AudienceSummary string           `bson:"audience_summary,omitempty" json:"audience_summary,omitempty"`
	ContentGoal     string           `bson:"content_goal,omitempty" json:"content_goal,omitempty"`
	Questions       []string         `bson:"questions,omitempty" json:"questions,omitempty"`
	Pillars         []string         `bson:"pillars,omitempty" json:"pillars,omitempty"`
	Exclusions      []string         `bson:"exclusions,omitempty" json:"exclusions,omitempty"`
	SuggestedTags   []SuggestedTag   `bson:"suggested_tags,omitempty" json:"suggested_tags,omitempty"`
	SimilarAccounts []SimilarAccount `bson:"similar_accounts,omitempty" json:"similar_accounts,omitempty"`
	BenchmarkNotes  string           `bson:"benchmark_notes,omitempty" json:"benchmark_notes,omitempty"`
}

func (m ResearchMap) IsEmpty() bool {
	return m.AudienceSummary == "" &&
		m.ContentGoal == "" &&
		len(m.Questions) == 0 &&
		len(m.SuggestedTags) == 0
}

type Mission struct {
	ID            string      `bson:"_id"`
	TenantID      string      `bson:"tenant_id"`
	OwnerUID      string      `bson:"owner_uid"`
	PersonaID     string      `bson:"persona_id"`
	Label         string      `bson:"label,omitempty"`
	SeedQuery     string      `bson:"seed_query,omitempty"`
	Brief         string      `bson:"brief,omitempty"`
	ResearchMap   ResearchMap `bson:"research_map,omitempty"`
	SelectedTags  []string    `bson:"selected_tags,omitempty"`
	LastScanJobID string      `bson:"last_scan_job_id,omitempty"`
	Status        Status      `bson:"status"`
	CreateAt      int64       `bson:"create_at"`
	UpdateAt      int64       `bson:"update_at"`
}
