package usecase

import (
	"context"

	"haixun-backend/internal/model/copy_mission/domain/entity"
)

type SuggestedTagSummary struct {
	Tag          string
	Reason       string
	SearchIntent string
	SearchType   string
}

type SimilarAccountSummary struct {
	Username        string
	Reason          string
	Source          string
	Confidence      string
	ProfileURL      string
	AuthorVerified  bool
	FollowerCount   int
	EngagementScore int
	LikeCount       int
	ReplyCount      int
	PostCount       int
}

type ResearchMapSummary struct {
	AudienceSummary string
	ContentGoal     string
	Questions       []string
	Pillars         []string
	Exclusions      []string
	SuggestedTags   []SuggestedTagSummary
	SimilarAccounts []SimilarAccountSummary
	BenchmarkNotes  string
}

type MissionSummary struct {
	ID            string
	PersonaID     string
	Label         string
	SeedQuery     string
	Brief         string
	ResearchMap   ResearchMapSummary
	SelectedTags  []string
	LastScanJobID string
	Status        string
	CreateAt      int64
	UpdateAt      int64
}

type CreateRequest struct {
	TenantID            string
	OwnerUID            string
	PersonaID           string
	Label               string
	SeedQuery           string
	Brief               string
	InitialResearchMap  *entity.ResearchMap
	InitialSelectedTags []string
}

type MissionPatch struct {
	Label           *string
	SeedQuery       *string
	Brief           *string
	AudienceSummary *string
	ContentGoal     *string
	QuestionsSet    bool
	Questions       []string
	PillarsSet      bool
	Pillars         []string
	ExclusionsSet   bool
	Exclusions      []string
	BenchmarkNotes  *string
	SelectedTagsSet bool
	SelectedTags    []string
	ResearchMap     *entity.ResearchMap
	LastScanJobID   *string
	Status          *entity.Status
}

type UpdateRequest struct {
	TenantID  string
	OwnerUID  string
	PersonaID string
	MissionID string
	Patch     MissionPatch
}

type ListResult struct {
	List []MissionSummary
}

type UseCase interface {
	List(ctx context.Context, tenantID, ownerUID, personaID string) (*ListResult, error)
	Create(ctx context.Context, req CreateRequest) (*MissionSummary, error)
	Get(ctx context.Context, tenantID, ownerUID, personaID, missionID string) (*MissionSummary, error)
	Update(ctx context.Context, req UpdateRequest) (*MissionSummary, error)
	Delete(ctx context.Context, tenantID, ownerUID, personaID, missionID string) error
}
