package usecase

import "context"

type TopicCandidateSummary struct {
	ID                  string
	PersonaID           string
	Name                string
	Source              string
	Category            string
	SeedQuery           string
	TrendReason         string
	TrendKeywords       []string
	HeatScore           int
	FitScore            int
	InteractionScore    int
	ExtendScore         int
	RiskScore           int
	FinalScore          float64
	RecommendedMissions []string
	Status              string
	CreateAt            int64
	UpdateAt            int64
}

type ContentPlanSummary struct {
	ID                  string
	PersonaID           string
	TopicCandidateID    string
	Topic               string
	Mission             string
	TargetAudience      string
	Angle               string
	OpeningType         string
	BodyType            string
	Emotion             string
	EndingType          string
	CtaType             string
	RiskLevel           string
	RequiresHumanReview bool
	Avoid               []string
	SelectedKnowledge   []string
	Status              string
	CreateAt            int64
	UpdateAt            int64
}

type FeedbackEventSummary struct {
	ID            string
	PersonaID     string
	ContentPlanID string
	DraftID       string
	Decision      string
	Note          string
	Snapshot      string
	CreateAt      int64
}

type KnowledgeSourceSummary struct {
	ID, PersonaID, SourceType, Title, Filename, ParsedStatus string
	ChunkCount                                               int
	CreateAt                                                 int64
}
type KnowledgeChunkSummary struct {
	ID, PersonaID, SourceID, Content, RiskLevel string
	Topics, StyleTags                           []string
	CreateAt                                    int64
}
type FormulaPoolSummary struct {
	ID, PersonaID, Type, Name, Pattern string
	UseCases, Avoid                    []string
	Weight                             int
	CreateAt, UpdateAt                 int64
}

type KnowledgeSourceInput struct{ TenantID, OwnerUID, PersonaID, SourceType, Title, Filename, Content, ContentBase64 string }
type FormulaPoolInput struct {
	TenantID, OwnerUID, PersonaID, Type, Name, Pattern string
	UseCases, Avoid                                    []string
	Weight                                             int
}

type TopicCandidateInput struct {
	TenantID            string
	OwnerUID            string
	PersonaID           string
	Name                string
	Source              string
	Category            string
	SeedQuery           string
	TrendReason         string
	TrendKeywords       []string
	HeatScore           int
	FitScore            int
	InteractionScore    int
	ExtendScore         int
	RiskScore           int
	RecommendedMissions []string
}

type ContentPlanInput struct {
	TenantID            string
	OwnerUID            string
	PersonaID           string
	TopicCandidateID    string
	Topic               string
	Mission             string
	TargetAudience      string
	Angle               string
	OpeningType         string
	BodyType            string
	Emotion             string
	EndingType          string
	CtaType             string
	RiskLevel           string
	RequiresHumanReview bool
	Avoid               []string
	SelectedKnowledge   []string
}

type ContentPlanPatch struct {
	Topic               *string
	Mission             *string
	TargetAudience      *string
	Angle               *string
	OpeningType         *string
	BodyType            *string
	Emotion             *string
	EndingType          *string
	CtaType             *string
	RiskLevel           *string
	RequiresHumanReview *bool
	Avoid               []string
	SelectedKnowledge   []string
	Status              *string
}

type FeedbackEventInput struct {
	TenantID      string
	OwnerUID      string
	PersonaID     string
	ContentPlanID string
	DraftID       string
	Decision      string
	Note          string
	Snapshot      string
}

type UseCase interface {
	CreateTopicCandidate(ctx context.Context, req TopicCandidateInput) (*TopicCandidateSummary, error)
	ListTopicCandidates(ctx context.Context, tenantID, ownerUID, personaID string, limit int) ([]TopicCandidateSummary, error)
	CreateContentPlan(ctx context.Context, req ContentPlanInput) (*ContentPlanSummary, error)
	UpdateContentPlan(ctx context.Context, tenantID, ownerUID, personaID, id string, patch ContentPlanPatch) (*ContentPlanSummary, error)
	GetContentPlan(ctx context.Context, tenantID, ownerUID, personaID, id string) (*ContentPlanSummary, error)
	ListContentPlans(ctx context.Context, tenantID, ownerUID, personaID string, limit int) ([]ContentPlanSummary, error)
	CreateFeedbackEvent(ctx context.Context, req FeedbackEventInput) (*FeedbackEventSummary, error)
	ListFeedbackEvents(ctx context.Context, tenantID, ownerUID, personaID string, limit int) ([]FeedbackEventSummary, error)
	CreateKnowledgeSource(ctx context.Context, req KnowledgeSourceInput) (*KnowledgeSourceSummary, error)
	ListKnowledgeSources(ctx context.Context, tenantID, ownerUID, personaID string, limit int) ([]KnowledgeSourceSummary, error)
	ListKnowledgeChunks(ctx context.Context, tenantID, ownerUID, personaID string, limit int) ([]KnowledgeChunkSummary, error)
	CreateFormulaPool(ctx context.Context, req FormulaPoolInput) (*FormulaPoolSummary, error)
	ListFormulaPools(ctx context.Context, tenantID, ownerUID, personaID string, limit int) ([]FormulaPoolSummary, error)
}
