// Code generated by goctl. DO NOT EDIT.
// goctl 1.10.1

package types

type AIChatData struct {
	Text         string `json:"text"`
	FinishReason string `json:"finish_reason,optional"`
}

type AIChatReq struct {
	Provider    string      `json:"provider" validate:"required,oneof=opencode-go xai"` // AI provider
	Model       string      `json:"model" validate:"required"`                          // 模型 ID
	System      string      `json:"system,optional"`                                    // system prompt
	Messages    []AIMessage `json:"messages" validate:"required,min=1,dive"`            // 對話訊息
	Temperature *float64    `json:"temperature,optional"`                               // 溫度
	MaxTokens   *int        `json:"max_tokens,optional"`                                // 最大輸出 token
}

type AIMessage struct {
	Role    string `json:"role" validate:"required,oneof=system user assistant"` // 訊息角色
	Content string `json:"content" validate:"required"`                          // 訊息內容
}

type AIProviderModelsData struct {
	ID      string   `json:"id"`
	Label   string   `json:"label"`
	Models  []string `json:"models"`
	Streams bool     `json:"streams"`
	Error   string   `json:"error,optional"` // 拉 models 失敗時的摘要
}

type AIProviderOption struct {
	ID      string `json:"id"`
	Label   string `json:"label"`
	Streams bool   `json:"streams"`
}

type AIProviderPath struct {
	Provider string `path:"provider" validate:"required,oneof=opencode-go xai"` // 要查模型的 provider
}

type AIProvidersData struct {
	Providers []AIProviderOption `json:"providers"`
}

type AnalyzeContentFormulaData struct {
	Formula ContentFormulaData `json:"formula"`
	Message string             `json:"message"`
}

type AnalyzeContentFormulaHandlerReq struct {
	ThreadsAccountPath
	AnalyzeContentFormulaReq
}

type AnalyzeContentFormulaReq struct {
	SourceType   string `json:"source_type" validate:"required"`
	PersonaID    string `json:"persona_id,optional"`
	PostText     string `json:"post_text,optional"`
	MediaID      string `json:"media_id,optional"`
	ScanPostID   string `json:"scan_post_id,optional"`
	Keyword      string `json:"keyword,optional"`
	SaveLabel    string `json:"save_label,optional"`
	AuthorName   string `json:"author_name,optional"`
	Permalink    string `json:"permalink,optional"`
	LikeCount    int    `json:"like_count,optional"`
	ReplyCount   int    `json:"reply_count,optional"`
	Views        int    `json:"views,optional"`
	RepostCount  int    `json:"repost_count,optional"`
	QuoteCount   int    `json:"quote_count,optional"`
	Shares       int    `json:"shares,optional"`
	ForceRefresh bool   `json:"force_refresh,optional"`
}

type AnalyzeStyle8DData struct {
	PersonaID      string `json:"persona_id"`
	PostCount      int    `json:"post_count"`
	StyleProfile   string `json:"style_profile"`
	StyleBenchmark string `json:"style_benchmark"`
}

type AnalyzeStyle8DPostReq struct {
	Text       string `json:"text"`
	Permalink  string `json:"permalink,optional"`
	LikeCount  int    `json:"like_count,optional"`
	ReplyCount int    `json:"reply_count,optional"`
}

type AnalyzeStyle8DReq struct {
	ID               string                  `path:"id" validate:"required"`
	WorkerID         string                  `json:"worker_id" validate:"required"`
	TenantID         string                  `json:"tenant_id" validate:"required"`
	OwnerUID         string                  `json:"owner_uid" validate:"required"`
	PersonaID        string                  `json:"persona_id" validate:"required"`
	ThreadsAccountID string                  `json:"threads_account_id" validate:"required"`
	Username         string                  `json:"username" validate:"required"`
	Posts            []AnalyzeStyle8DPostReq `json:"posts" validate:"required"`
	Steps            []JobStepProgressData   `json:"steps,optional"`
}

type AuthLoginReq struct {
	TenantID string `json:"tenant_id" validate:"required"`
	Email    string `json:"email" validate:"required,email"`
	Password string `json:"password" validate:"required,min=8,max=128"`
}

type AuthRefreshReq struct {
	RefreshToken string `json:"refresh_token" validate:"required"`
}

type AuthRegisterReq struct {
	TenantID    string `json:"tenant_id" validate:"required"`
	Email       string `json:"email" validate:"required,email"`
	Password    string `json:"password" validate:"required,min=8,max=128"`
	DisplayName string `json:"display_name,optional"`
	Language    string `json:"language,optional"`
}

type AuthTokenData struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int64  `json:"expires_in"`
	UID          string `json:"uid"`
	TokenType    string `json:"token_type"`
}

type BatchDeletePlacementTopicScanPostsData struct {
	DeletedCount int `json:"deleted_count"`
}

type BatchDeletePlacementTopicScanPostsHandlerReq struct {
	PlacementTopicPath
	BatchDeletePlacementTopicScanPostsReq
}

type BatchDeletePlacementTopicScanPostsReq struct {
	PostIDs []string `json:"post_ids" validate:"required"`
}

type BrandData struct {
	ID             string             `json:"id"`
	DisplayName    string             `json:"display_name,omitempty"`
	TopicName      string             `json:"topic_name,omitempty"`
	SeedQuery      string             `json:"seed_query,omitempty"`
	Brief          string             `json:"brief,omitempty"`
	ProductBrief   string             `json:"product_brief,omitempty"`
	ProductContext string             `json:"product_context,omitempty"`
	ProductID      string             `json:"product_id,omitempty"`
	Products       []BrandProductData `json:"products,omitempty"`
	TargetAudience string             `json:"target_audience,omitempty"`
	Goals          string             `json:"goals,omitempty"`
	ResearchMap    ResearchMapData    `json:"research_map,omitempty"`
	CreateAt       int64              `json:"create_at"`
	UpdateAt       int64              `json:"update_at"`
}

type BrandPath struct {
	ID string `path:"id" validate:"required"`
}

type BrandProductData struct {
	ID             string   `json:"id"`
	Label          string   `json:"label"`
	ProductContext string   `json:"product_context"`
	PlacementURL   string   `json:"placement_url,omitempty"`
	MatchTags      []string `json:"match_tags,omitempty"`
	CreateAt       int64    `json:"create_at"`
	UpdateAt       int64    `json:"update_at"`
}

type BrandProductPath struct {
	ID        string `path:"id" validate:"required"`
	ProductID string `path:"productId" validate:"required"`
}

type BrandScanScheduleData struct {
	ID        string `json:"id,omitempty"`
	BrandID   string `json:"brand_id"`
	Cron      string `json:"cron"`
	Timezone  string `json:"timezone"`
	Enabled   bool   `json:"enabled"`
	NextRunAt int64  `json:"next_run_at,omitempty"`
	LastRunAt int64  `json:"last_run_at,omitempty"`
}

type BraveSourceData struct {
	Query   string `json:"query,omitempty"`
	Title   string `json:"title,omitempty"`
	URL     string `json:"url,omitempty"`
	Snippet string `json:"snippet,omitempty"`
}

type CancelJobReq struct {
	ID     string `path:"id" validate:"required"` // job run id
	Reason string `json:"reason,optional"`        // cancel reason
}

type ClaimWorkerJobReq struct {
	WorkerType string `json:"worker_type" validate:"required"`
	WorkerID   string `json:"worker_id" validate:"required"`
}

type ContentFormulaData struct {
	ID              string                           `json:"id"`
	AccountID       string                           `json:"account_id"`
	Label           string                           `json:"label"`
	SourceType      string                           `json:"source_type"`
	SourceRef       string                           `json:"source_ref,omitempty"`
	SourcePostText  string                           `json:"source_post_text,omitempty"`
	SourceAuthor    string                           `json:"source_author,omitempty"`
	SourcePermalink string                           `json:"source_permalink,omitempty"`
	SourceMetrics   *ContentFormulaSourceMetricsData `json:"source_metrics,omitempty"`
	Summary         string                           `json:"summary"`
	Wins            []string                         `json:"wins,omitempty"`
	Improvements    []string                         `json:"improvements,omitempty"`
	Formula         string                           `json:"formula"`
	PostTemplate    string                           `json:"post_template"`
	HookPattern     string                           `json:"hook_pattern"`
	Structure       string                           `json:"structure"`
	ReplicationTips []string                         `json:"replication_tips,omitempty"`
	Avoid           []string                         `json:"avoid,omitempty"`
	Tags            []string                         `json:"tags,omitempty"`
	CreateAt        int64                            `json:"create_at"`
	UpdateAt        int64                            `json:"update_at"`
}

type ContentFormulaItemPath struct {
	ID        string `path:"id" validate:"required"`
	FormulaID string `path:"formulaId" validate:"required"`
}

type ContentFormulaPath struct {
	ID        string `path:"id" validate:"required"`
	FormulaID string `path:"formulaId" validate:"required"`
}

type ContentFormulaSearchPostData struct {
	Text            string `json:"text"`
	Author          string `json:"author"`
	Permalink       string `json:"permalink,omitempty"`
	MediaID         string `json:"media_id,omitempty"`
	LikeCount       int    `json:"like_count"`
	ReplyCount      int    `json:"reply_count"`
	EngagementScore int    `json:"engagement_score"`
}

type ContentFormulaSourceMetricsData struct {
	LikeCount   int `json:"like_count,omitempty"`
	ReplyCount  int `json:"reply_count,omitempty"`
	Views       int `json:"views,omitempty"`
	RepostCount int `json:"repost_count,omitempty"`
	QuoteCount  int `json:"quote_count,omitempty"`
	Shares      int `json:"shares,omitempty"`
}

type ContentInboxItemData struct {
	CopyDraftData
	ScheduledAt  int64  `json:"scheduled_at,omitempty"`
	Lifecycle    string `json:"lifecycle"`
	GroupDate    int64  `json:"group_date"`
	FormulaLabel string `json:"formula_label,omitempty"`
}

type ContentMatrixData struct {
	ID          string                 `json:"id,omitempty"`
	BrandID     string                 `json:"brand_id"`
	Rows        []ContentMatrixRowData `json:"rows"`
	GeneratedAt int64                  `json:"generated_at"`
	CreateAt    int64                  `json:"create_at,omitempty"`
	UpdateAt    int64                  `json:"update_at,omitempty"`
}

type ContentMatrixRowData struct {
	SortOrder        int      `json:"sort_order"`
	SearchTag        string   `json:"search_tag"`
	Angle            string   `json:"angle"`
	Hook             string   `json:"hook"`
	Text             string   `json:"text"`
	ReferenceNotes   string   `json:"reference_notes"`
	SourcePermalinks []string `json:"source_permalinks"`
	Rationale        string   `json:"rationale"`
}

type ContentPlanData struct {
	ID                  string   `json:"id"`
	PersonaID           string   `json:"persona_id"`
	TopicCandidateID    string   `json:"topic_candidate_id,omitempty"`
	Topic               string   `json:"topic"`
	Mission             string   `json:"mission"`
	TargetAudience      string   `json:"target_audience,omitempty"`
	Angle               string   `json:"angle,omitempty"`
	OpeningType         string   `json:"opening_type,omitempty"`
	BodyType            string   `json:"body_type,omitempty"`
	Emotion             string   `json:"emotion,omitempty"`
	EndingType          string   `json:"ending_type,omitempty"`
	CtaType             string   `json:"cta_type,omitempty"`
	RiskLevel           string   `json:"risk_level,omitempty"`
	RequiresHumanReview bool     `json:"requires_human_review,omitempty"`
	Avoid               []string `json:"avoid,omitempty"`
	SelectedKnowledge   []string `json:"selected_knowledge,omitempty"`
	Status              string   `json:"status,omitempty"`
	CreateAt            int64    `json:"create_at"`
	UpdateAt            int64    `json:"update_at"`
}

type ContentPlanPath struct {
	ID            string `path:"id" validate:"required"`
	ContentPlanID string `path:"contentPlanId" validate:"required"`
}

type CopyAudienceSampleData struct {
	Username       string `json:"username"`
	SamplePostId   string `json:"sample_post_id,omitempty"`
	SampleText     string `json:"sample_text,omitempty"`
	ReplyLikeCount int    `json:"reply_like_count,omitempty"`
	Appearances    int    `json:"appearances,omitempty"`
	FirstSeenAt    int64  `json:"first_seen_at"`
	LastSeenAt     int64  `json:"last_seen_at,omitempty"`
	Status         string `json:"status,omitempty"`
}

type CopyDraftData struct {
	ID                  string   `json:"id"`
	PersonaID           string   `json:"persona_id"`
	ContentPlanID       string   `json:"content_plan_id,omitempty"`
	CopyMissionID       string   `json:"copy_mission_id,omitempty"`
	ScanPostID          string   `json:"scan_post_id,omitempty"`
	FormulaID           string   `json:"formula_id,omitempty"`
	DraftType           string   `json:"draft_type"`
	SortOrder           int      `json:"sort_order,omitempty"`
	Text                string   `json:"text"`
	TopicTag            string   `json:"topic_tag,omitempty"`
	Angle               string   `json:"angle,omitempty"`
	Hook                string   `json:"hook,omitempty"`
	Rationale           string   `json:"rationale,omitempty"`
	ReferenceNotes      string   `json:"reference_notes,omitempty"`
	Sources             []string `json:"sources,omitempty"`
	AiScore             int      `json:"ai_score,omitempty"`
	FormulaScore        int      `json:"formula_score,omitempty"`
	BrandFitScore       int      `json:"brand_fit_score,omitempty"`
	RiskScore           int      `json:"risk_score,omitempty"`
	SimilarityScore     int      `json:"similarity_score,omitempty"`
	EngagementPotential int      `json:"engagement_potential,omitempty"`
	FreshnessScore      int      `json:"freshness_score,omitempty"`
	ReviewSuggestion    string   `json:"review_suggestion,omitempty"`
	Status              string   `json:"status,omitempty"`
	PublishQueueID      string   `json:"publish_queue_id,omitempty"`
	PublishedMediaID    string   `json:"published_media_id,omitempty"`
	PublishedPermalink  string   `json:"published_permalink,omitempty"`
	PublishedAt         int64    `json:"published_at,omitempty"`
	CreateAt            int64    `json:"create_at"`
}

type CopyDraftPath struct {
	ID      string `path:"id" validate:"required"`
	DraftID string `path:"draftId" validate:"required"`
}

type CopyMissionData struct {
	ID            string                     `json:"id"`
	PersonaID     string                     `json:"persona_id"`
	Label         string                     `json:"label,omitempty"`
	SeedQuery     string                     `json:"seed_query,omitempty"`
	Brief         string                     `json:"brief,omitempty"`
	ResearchMap   CopyMissionResearchMapData `json:"research_map,omitempty"`
	SelectedTags  []string                   `json:"selected_tags,omitempty"`
	LastScanJobID string                     `json:"last_scan_job_id,omitempty"`
	Status        string                     `json:"status,omitempty"`
	CreateAt      int64                      `json:"create_at"`
	UpdateAt      int64                      `json:"update_at"`
}

type CopyMissionInspirationData struct {
	TopicCandidateID string                             `json:"topic_candidate_id,omitempty"`
	ContentPlanID    string                             `json:"content_plan_id,omitempty"`
	Label            string                             `json:"label"`
	SeedQuery        string                             `json:"seed_query"`
	Brief            string                             `json:"brief"`
	TrendReason      string                             `json:"trend_reason,omitempty"`
	TrendKeywords    []string                           `json:"trend_keywords,omitempty"`
	Angles           []string                           `json:"angles,omitempty"`
	Mission          string                             `json:"mission,omitempty"`
	TargetAudience   string                             `json:"target_audience,omitempty"`
	OpeningType      string                             `json:"opening_type,omitempty"`
	BodyType         string                             `json:"body_type,omitempty"`
	Emotion          string                             `json:"emotion,omitempty"`
	CtaType          string                             `json:"cta_type,omitempty"`
	RiskLevel        string                             `json:"risk_level,omitempty"`
	Avoid            []string                           `json:"avoid,omitempty"`
	Sources          []CopyMissionInspirationSourceData `json:"sources,omitempty"`
	WebSearchUsed    bool                               `json:"web_search_used"`
	Message          string                             `json:"message"`
}

type CopyMissionInspirationHandlerReq struct {
	PersonaCopyMissionsPath
	CopyMissionInspirationReq
}

type CopyMissionInspirationReq struct {
	Keyword          string   `json:"keyword,optional"`
	ContentDirection string   `json:"content_direction,optional"`
	UseWebSearch     bool     `json:"use_web_search,optional"`
	AvoidTopics      []string `json:"avoid_topics,optional"`
}

type CopyMissionInspirationSourceData struct {
	Query   string `json:"query,omitempty"`
	Title   string `json:"title,omitempty"`
	Snippet string `json:"snippet,omitempty"`
	URL     string `json:"url,omitempty"`
}

type CopyMissionPath struct {
	PersonaID string `path:"personaId" validate:"required"`
	ID        string `path:"id" validate:"required"`
}

type CopyMissionResearchItemData struct {
	Title   string `json:"title,omitempty"`
	URL     string `json:"url,omitempty"`
	Snippet string `json:"snippet,omitempty"`
	Query   string `json:"query,omitempty"`
}

type CopyMissionResearchMapData struct {
	AudienceSummary        string                        `json:"audience_summary,omitempty"`
	ContentGoal            string                        `json:"content_goal,omitempty"`
	Questions              []string                      `json:"questions,omitempty"`
	Pillars                []string                      `json:"pillars,omitempty"`
	Exclusions             []string                      `json:"exclusions,omitempty"`
	KnowledgeItems         []string                      `json:"knowledge_items,omitempty"`
	SelectedKnowledgeItems []string                      `json:"selected_knowledge_items,omitempty"`
	ResearchItems          []CopyMissionResearchItemData `json:"research_items,omitempty"`
	SuggestedTags          []CopySuggestedTagData        `json:"suggested_tags,omitempty"`
	SimilarAccounts        []CopySimilarAccountData      `json:"similar_accounts,omitempty"`
	AudienceSamples        []CopyAudienceSampleData      `json:"audience_samples,omitempty"`
	BenchmarkNotes         string                        `json:"benchmark_notes,omitempty"`
}

type CopyMissionScanScheduleData struct {
	ID        string `json:"id,omitempty"`
	PersonaID string `json:"persona_id"`
	MissionID string `json:"mission_id"`
	Cron      string `json:"cron"`
	Timezone  string `json:"timezone"`
	Enabled   bool   `json:"enabled"`
	NextRunAt int64  `json:"next_run_at,omitempty"`
	LastRunAt int64  `json:"last_run_at,omitempty"`
}

type CopyMissionScheduleCopyDraftsData struct {
	Scheduled int                    `json:"scheduled"`
	List      []PublishQueueItemData `json:"list"`
	Message   string                 `json:"message"`
}

type CopyMissionScheduleCopyDraftsReq struct {
	AccountID string            `json:"account_id" validate:"required"`
	DraftIDs  []string          `json:"draft_ids" validate:"required,min=1"`
	StartAt   int64             `json:"start_at,optional"`
	Timezone  string            `json:"timezone,optional"`
	Slots     []PublishSlotData `json:"slots,optional"`
	Mode      string            `json:"mode,optional"`
}

type CopyMissionSimilarAccountPath struct {
	PersonaID string `path:"personaId" validate:"required"`
	ID        string `path:"id" validate:"required"`
	Username  string `path:"username" validate:"required"`
}

type CopyResearchMapData struct {
	AudienceSummary string   `json:"audience_summary,omitempty"`
	ContentGoal     string   `json:"content_goal,omitempty"`
	Questions       []string `json:"questions,omitempty"`
	Pillars         []string `json:"pillars,omitempty"`
	Exclusions      []string `json:"exclusions,omitempty"`
	SuggestedTags   []string `json:"suggested_tags,omitempty"`
	BenchmarkNotes  string   `json:"benchmark_notes,omitempty"`
}

type CopySimilarAccountData struct {
	Username        string   `json:"username"`
	Reason          string   `json:"reason,omitempty"`
	Source          string   `json:"source,omitempty"`
	MatchedSource   []string `json:"matched_source,omitempty"`
	Confidence      string   `json:"confidence,omitempty"`
	Status          string   `json:"status,omitempty"`
	TopicRelevance  float64  `json:"topic_relevance,omitempty"`
	LastSeenAt      int64    `json:"last_seen_at,omitempty"`
	ProfileUrl      string   `json:"profile_url,omitempty"`
	AuthorVerified  bool     `json:"author_verified,omitempty"`
	FollowerCount   int      `json:"follower_count,omitempty"`
	EngagementScore int      `json:"engagement_score,omitempty"`
	LikeCount       int      `json:"like_count,omitempty"`
	ReplyCount      int      `json:"reply_count,omitempty"`
	PostCount       int      `json:"post_count,omitempty"`
}

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

type CreateBrandProductHandlerReq struct {
	BrandPath
	CreateBrandProductReq
}

type CreateBrandProductReq struct {
	Label          string   `json:"label" validate:"required"`
	ProductContext string   `json:"product_context" validate:"required"`
	PlacementURL   string   `json:"placement_url,optional"`
	MatchTags      []string `json:"match_tags,optional"`
}

type CreateBrandReq struct {
	DisplayName string `json:"display_name,optional"`
}

type CreateContentPlanHandlerReq struct {
	PersonaPath
	CreateContentPlanReq
}

type CreateContentPlanReq struct {
	TopicCandidateID    string   `json:"topic_candidate_id,optional"`
	Topic               string   `json:"topic" validate:"required"`
	Mission             string   `json:"mission" validate:"required"`
	TargetAudience      string   `json:"target_audience,optional"`
	Angle               string   `json:"angle,optional"`
	OpeningType         string   `json:"opening_type,optional"`
	BodyType            string   `json:"body_type,optional"`
	Emotion             string   `json:"emotion,optional"`
	EndingType          string   `json:"ending_type,optional"`
	CtaType             string   `json:"cta_type,optional"`
	RiskLevel           string   `json:"risk_level,optional"`
	RequiresHumanReview bool     `json:"requires_human_review,optional"`
	Avoid               []string `json:"avoid,optional"`
	SelectedKnowledge   []string `json:"selected_knowledge,optional"`
}

type CreateCopyMissionHandlerReq struct {
	PersonaCopyMissionsPath
	CreateCopyMissionReq
}

type CreateCopyMissionReq struct {
	Label     string `json:"label" validate:"required"`
	SeedQuery string `json:"seed_query" validate:"required"`
	Brief     string `json:"brief" validate:"required"`
}

type CreateFeedbackEventHandlerReq struct {
	PersonaPath
	CreateFeedbackEventReq
}

type CreateFeedbackEventReq struct {
	ContentPlanID string `json:"content_plan_id,optional"`
	DraftID       string `json:"draft_id,optional"`
	Decision      string `json:"decision" validate:"required"`
	Note          string `json:"note,optional"`
	Snapshot      string `json:"snapshot,optional"`
}

type CreateFormulaPoolHandlerReq struct {
	PersonaPath
	CreateFormulaPoolReq
}

type CreateFormulaPoolReq struct {
	Type     string   `json:"type" validate:"required"`
	Name     string   `json:"name" validate:"required"`
	Pattern  string   `json:"pattern,optional"`
	UseCases []string `json:"use_cases,optional"`
	Avoid    []string `json:"avoid,optional"`
	Weight   int      `json:"weight,optional"`
}

type CreateJobReq struct {
	TemplateType string                 `json:"template_type" validate:"required"`                                 // job template type
	Scope        string                 `json:"scope" validate:"required,oneof=user account system persona brand"` // job scope
	ScopeID      string                 `json:"scope_id" validate:"required"`                                      // scope id
	Payload      map[string]interface{} `json:"payload,optional"`                                                  // job payload
}

type CreateJobScheduleReq struct {
	TemplateType    string                 `json:"template_type" validate:"required"`                                 // template type
	Scope           string                 `json:"scope" validate:"required,oneof=user account system persona brand"` // scope
	ScopeID         string                 `json:"scope_id" validate:"required"`                                      // scope id
	Cron            string                 `json:"cron" validate:"required"`                                          // cron expression
	Timezone        string                 `json:"timezone,optional"`                                                 // timezone
	PayloadTemplate map[string]interface{} `json:"payload_template,optional"`                                         // payload template
	Enabled         bool                   `json:"enabled"`                                                           // enabled flag
}

type CreateKnowledgeSourceHandlerReq struct {
	PersonaPath
	CreateKnowledgeSourceReq
}

type CreateKnowledgeSourceReq struct {
	SourceType    string `json:"source_type" validate:"required"`
	Title         string `json:"title,optional"`
	Filename      string `json:"filename,optional"`
	Content       string `json:"content,optional"`
	ContentBase64 string `json:"content_base64,optional"`
}

type CreatePersonaReq struct {
	DisplayName string `json:"display_name,optional"`
}

type CreatePlacementTopicHandlerReq struct {
	CreatePlacementTopicReq
}

type CreatePlacementTopicReq struct {
	BrandID   string `json:"brand_id" validate:"required"`
	TopicName string `json:"topic_name" validate:"required"`
	SeedQuery string `json:"seed_query" validate:"required"`
	Brief     string `json:"brief" validate:"required"`
	ProductID string `json:"product_id,optional"`
}

type CreatePublishQueueHandlerReq struct {
	ThreadsAccountPath
	CreatePublishQueueReq
}

type CreatePublishQueueReq struct {
	Text        string `json:"text" validate:"required"`
	TopicTag    string `json:"topic_tag,optional"`
	ScheduledAt int64  `json:"scheduled_at,optional"`
}

type CreateThreadsAccountReq struct {
	DisplayName string `json:"display_name,optional"`
	Activate    *bool  `json:"activate,optional"`
}

type DeleteContentFormulaData struct {
	FormulaID string `json:"formula_id"`
	Message   string `json:"message"`
}

type DeleteCopyDraftData struct {
	DraftID string `json:"draft_id"`
	Message string `json:"message"`
}

type DeleteCopyMissionMatrixDraftsData struct {
	Deleted int    `json:"deleted"`
	Message string `json:"message"`
}

type DeleteCopyMissionMatrixDraftsHandlerReq struct {
	CopyMissionPath
	DeleteCopyMissionMatrixDraftsReq
}

type DeleteCopyMissionMatrixDraftsReq struct {
	DraftIDs []string `json:"draft_ids,optional"`
}

type DeletePlacementTopicScanPostHandlerReq struct {
	PlacementTopicPath
	PostID string `path:"postId" validate:"required"`
}

type DeleteThreadsAccountData struct {
	DeletedID       string `json:"deleted_id"`
	ActiveAccountID string `json:"active_account_id,omitempty"`
	Message         string `json:"message"`
}

type ErrorDetail struct {
	BizCode  string `json:"biz_code,optional"`
	Scope    int64  `json:"scope,optional"`
	Category int64  `json:"category,optional"`
	Detail   int64  `json:"detail,optional"`
}

type ExpandCopyMissionGraphHandlerReq struct {
	CopyMissionPath
	ExpandKnowledgeGraphReq
}

type ExpandKnowledgeGraphData struct {
	JobID   string `json:"job_id"`
	Status  string `json:"status"`
	Message string `json:"message"`
}

type ExpandKnowledgeGraphHandlerReq struct {
	BrandPath
	ExpandKnowledgeGraphReq
}

type ExpandKnowledgeGraphReq struct {
	SeedQuery      string `json:"seed_query" validate:"required"`
	Supplemental   bool   `json:"supplemental,optional"`
	RegenerateMap  bool   `json:"regenerate_map,optional"`
	ExpandStrategy string `json:"expand_strategy,optional"` // brave | llm | hybrid
}

type ExpandPlacementTopicGraphHandlerReq struct {
	PlacementTopicPath
	ExpandKnowledgeGraphReq
}

type FeedbackEventData struct {
	ID            string `json:"id"`
	PersonaID     string `json:"persona_id"`
	ContentPlanID string `json:"content_plan_id,omitempty"`
	DraftID       string `json:"draft_id,omitempty"`
	Decision      string `json:"decision"`
	Note          string `json:"note,omitempty"`
	Snapshot      string `json:"snapshot,omitempty"`
	CreateAt      int64  `json:"create_at"`
}

type FormulaPoolData struct {
	ID        string   `json:"id"`
	PersonaID string   `json:"persona_id"`
	Type      string   `json:"type"`
	Name      string   `json:"name"`
	Pattern   string   `json:"pattern,omitempty"`
	UseCases  []string `json:"use_cases,omitempty"`
	Avoid     []string `json:"avoid,omitempty"`
	Weight    int      `json:"weight,omitempty"`
	CreateAt  int64    `json:"create_at"`
	UpdateAt  int64    `json:"update_at"`
}

type GenerateContentMatrixHandlerReq struct {
	BrandPath
	GenerateContentMatrixReq
}

type GenerateContentMatrixReq struct {
	Count int `json:"count,optional"`
}

type GenerateCopyMissionMatrixData struct {
	Drafts  []CopyDraftData `json:"drafts"`
	Message string          `json:"message"`
}

type GenerateCopyMissionMatrixHandlerReq struct {
	CopyMissionPath
	GenerateCopyMissionMatrixReq
}

type GenerateCopyMissionMatrixReq struct {
	Count int `json:"count,optional"`
}

type GenerateFromContentFormulaData struct {
	List    []CopyDraftData `json:"list"`
	Message string          `json:"message"`
}

type GenerateFromContentFormulaHandlerReq struct {
	ContentFormulaPath
	GenerateFromContentFormulaReq
}

type GenerateFromContentFormulaReq struct {
	AccountID    string `json:"account_id" validate:"required"`
	Topic        string `json:"topic" validate:"required"`
	Brief        string `json:"brief,optional"`
	UseWebSearch bool   `json:"use_web_search,optional"`
	DraftCount   int    `json:"draft_count,optional"`
}

type GenerateOutreachDraftsData struct {
	ID         string                  `json:"id"`
	ScanPostID string                  `json:"scan_post_id"`
	Relevance  float64                 `json:"relevance"`
	Reason     string                  `json:"reason"`
	Drafts     []OutreachDraftItemData `json:"drafts"`
	CreateAt   int64                   `json:"create_at"`
}

type GenerateOutreachDraftsHandlerReq struct {
	BrandPath
	GenerateOutreachDraftsReq
}

type GenerateOutreachDraftsReq struct {
	ScanPostID     string `json:"scan_post_id" validate:"required"`
	TopicID        string `json:"topic_id,optional"`
	Count          int    `json:"count,optional"`
	VoicePersonaID string `json:"voice_persona_id,optional"`
	ProductID      string `json:"product_id,optional"`
	Regenerate     bool   `json:"regenerate,optional"`
}

type GenerateOwnPostFormulaData struct {
	OwnPostFormulaReviewData
}

type GenerateOwnPostFormulaHandlerReq struct {
	ThreadsAccountPath
	GenerateOwnPostFormulaReq
}

type GenerateOwnPostFormulaReq struct {
	MediaID     string `json:"media_id"`
	PersonaID   string `json:"persona_id,optional"`
	PostText    string `json:"post_text,optional"`
	TopicTag    string `json:"topic_tag,optional"`
	MediaType   string `json:"media_type,optional"`
	Timestamp   string `json:"timestamp,optional"`
	LikeCount   int    `json:"like_count,optional"`
	ReplyCount  int    `json:"reply_count,optional"`
	Views       int    `json:"views,optional"`
	RepostCount int    `json:"repost_count,optional"`
	QuoteCount  int    `json:"quote_count,optional"`
	Shares      int    `json:"shares,optional"`
	Force       bool   `json:"force,optional"`
}

type GenerateOwnPostReplyDraftData struct {
	Text string `json:"text"`
}

type GenerateOwnPostReplyDraftHandlerReq struct {
	ThreadsAccountPath
	GenerateOwnPostReplyDraftReq
}

type GenerateOwnPostReplyDraftReq struct {
	MediaID         string `json:"media_id"`
	PersonaID       string `json:"persona_id,optional"`
	ReplyToID       string `json:"reply_to_id,optional"`
	PostText        string `json:"post_text,optional"`
	ReplyText       string `json:"reply_text,optional"`
	ThreadPostText  string `json:"thread_post_text,optional"`
	ParentReplyText string `json:"parent_reply_text,optional"`
}

type GeneratePersonaCopyDraftData struct {
	Draft   CopyDraftData `json:"draft"`
	Message string        `json:"message"`
}

type GeneratePersonaCopyDraftHandlerReq struct {
	PersonaPath
	GeneratePersonaCopyDraftReq
}

type GeneratePersonaCopyDraftReq struct {
	ScanPostID string `json:"scan_post_id" validate:"required"`
}

type GeneratePersonaTopicMatrixData struct {
	List    []CopyDraftData `json:"list"`
	Message string          `json:"message"`
}

type GeneratePersonaTopicMatrixHandlerReq struct {
	PersonaPath
	GeneratePersonaTopicMatrixReq
}

type GeneratePersonaTopicMatrixReq struct {
	Topic         string `json:"topic" validate:"required"`
	ContentPlanID string `json:"content_plan_id,optional"`
	Brief         string `json:"brief,optional"`
	UseWebSearch  bool   `json:"use_web_search,optional"`
	DraftCount    int    `json:"draft_count,optional"`
}

type GeneratePlacementTopicContentMatrixHandlerReq struct {
	PlacementTopicPath
	GenerateContentMatrixReq
}

type GeneratePlacementTopicOutreachDraftsHandlerReq struct {
	PlacementTopicPath
	GenerateOutreachDraftsReq
}

type GetContentFormulaHandlerReq struct {
	ContentFormulaItemPath
}

type HealthData struct {
	Pong string `json:"pong"`
}

type ImportOwnPostFormulaHandlerReq struct {
	ThreadsAccountPath
	ImportOwnPostFormulaReq
}

type ImportOwnPostFormulaReq struct {
	MediaID string `json:"media_id" validate:"required"`
	Label   string `json:"label,optional"`
}

type ImportThreadsAccountSessionData struct {
	Success   bool   `json:"success"`
	Valid     bool   `json:"valid"`
	Synced    bool   `json:"synced"`
	AccountID string `json:"account_id"`
	Username  string `json:"username,omitempty"`
	Message   string `json:"message"`
	UpdateAt  int64  `json:"update_at"`
}

type ImportThreadsAccountSessionHandlerReq struct {
	ThreadsAccountPath
	ImportThreadsAccountSessionReq
}

type ImportThreadsAccountSessionReq struct {
	StorageState string `json:"storageState" validate:"required"`
}

type IslanderChatReq struct {
	Messages []AIMessage `json:"messages" validate:"required,min=1,dive"` // 對話訊息
	Context  string      `json:"context,optional"`                        // 目前頁面與站內導覽快照
}

type JobCancelPolicyData struct {
	Supported    bool   `json:"supported"`
	Mode         string `json:"mode"`
	GraceSeconds int    `json:"grace_seconds"`
}

type JobData struct {
	ID                string                 `json:"id"`
	TemplateType      string                 `json:"template_type"`
	TemplateVersion   int                    `json:"template_version"`
	Scope             string                 `json:"scope"`
	ScopeID           string                 `json:"scope_id"`
	Status            string                 `json:"status"`
	Phase             string                 `json:"phase"`
	WorkerType        string                 `json:"worker_type"`
	Payload           map[string]interface{} `json:"payload"`
	Progress          JobProgressData        `json:"progress"`
	Result            map[string]interface{} `json:"result,optional"`
	Error             string                 `json:"error,optional"`
	Attempt           int                    `json:"attempt"`
	MaxAttempts       int                    `json:"max_attempts"`
	CancelRequestedAt *int64                 `json:"cancel_requested_at,optional"`
	CancelReason      string                 `json:"cancel_reason,optional"`
	StartedAt         *int64                 `json:"started_at,optional"`
	CompletedAt       *int64                 `json:"completed_at,optional"`
	CreateAt          int64                  `json:"create_at"`
	UpdateAt          int64                  `json:"update_at"`
}

type JobEventData struct {
	ID       string                 `json:"id"`
	JobID    string                 `json:"job_id"`
	Type     string                 `json:"type"`
	From     string                 `json:"from,optional"`
	To       string                 `json:"to,optional"`
	Message  string                 `json:"message"`
	Metadata map[string]interface{} `json:"metadata,optional"`
	CreateAt int64                  `json:"create_at"`
}

type JobEventListData struct {
	List []JobEventData `json:"list"`
}

type JobIDPath struct {
	ID string `path:"id" validate:"required"` // job run id
}

type JobListData struct {
	Pagination PaginationData `json:"pagination"`
	List       []JobData      `json:"list"`
}

type JobProgressData struct {
	Summary    string                `json:"summary"`
	Percentage int                   `json:"percentage"`
	Steps      []JobStepProgressData `json:"steps"`
}

type JobRetryPolicyData struct {
	MaxAttempts    int   `json:"max_attempts"`
	BackoffSeconds []int `json:"backoff_seconds"`
}

type JobScheduleData struct {
	ID              string                 `json:"id"`
	TemplateType    string                 `json:"template_type"`
	Scope           string                 `json:"scope"`
	ScopeID         string                 `json:"scope_id"`
	Enabled         bool                   `json:"enabled"`
	Cron            string                 `json:"cron"`
	Timezone        string                 `json:"timezone"`
	PayloadTemplate map[string]interface{} `json:"payload_template"`
	LastRunAt       *int64                 `json:"last_run_at,optional"`
	NextRunAt       int64                  `json:"next_run_at"`
	CreateAt        int64                  `json:"create_at"`
	UpdateAt        int64                  `json:"update_at"`
}

type JobScheduleIDPath struct {
	ID string `path:"id" validate:"required"` // schedule id
}

type JobScheduleListData struct {
	Pagination PaginationData    `json:"pagination"`
	List       []JobScheduleData `json:"list"`
}

type JobStepProgressData struct {
	ID        string `json:"id"`
	Status    string `json:"status"`
	StartedAt *int64 `json:"started_at,optional"`
	EndedAt   *int64 `json:"ended_at,optional"`
	Message   string `json:"message,optional"`
}

type JobTemplateData struct {
	Type              string                `json:"type"`
	Version           int                   `json:"version"`
	Name              string                `json:"name"`
	Description       string                `json:"description"`
	Enabled           bool                  `json:"enabled"`
	Repeatable        bool                  `json:"repeatable"`
	ConcurrencyPolicy string                `json:"concurrency_policy"`
	DedupeKeys        []string              `json:"dedupe_keys"`
	TimeoutSeconds    int                   `json:"timeout_seconds"`
	CancelPolicy      JobCancelPolicyData   `json:"cancel_policy"`
	RetryPolicy       JobRetryPolicyData    `json:"retry_policy"`
	Steps             []JobTemplateStepData `json:"steps"`
}

type JobTemplateListData struct {
	List []JobTemplateData `json:"list"`
}

type JobTemplatePath struct {
	Type string `path:"type" validate:"required"` // template type
}

type JobTemplateStepData struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	WorkerType     string `json:"worker_type"`
	TimeoutSeconds int    `json:"timeout_seconds"`
	Cancelable     bool   `json:"cancelable"`
}

type KnowledgeChunkData struct {
	ID        string   `json:"id"`
	PersonaID string   `json:"persona_id"`
	SourceID  string   `json:"source_id"`
	Content   string   `json:"content"`
	Topics    []string `json:"topics,omitempty"`
	StyleTags []string `json:"style_tags,omitempty"`
	RiskLevel string   `json:"risk_level,omitempty"`
	CreateAt  int64    `json:"create_at"`
}

type KnowledgeGraphData struct {
	ID             string                   `json:"id"`
	BrandID        string                   `json:"brand_id"`
	Seed           string                   `json:"seed"`
	Nodes          []KnowledgeGraphNodeData `json:"nodes"`
	Edges          []KnowledgeGraphEdgeData `json:"edges"`
	BraveSources   []BraveSourceData        `json:"brave_sources,omitempty"`
	ExpandStrategy string                   `json:"expand_strategy,omitempty"`
	PainTagCount   int                      `json:"pain_tag_count"`
	GeneratedAt    int64                    `json:"generated_at"`
	CreateAt       int64                    `json:"create_at"`
	UpdateAt       int64                    `json:"update_at"`
}

type KnowledgeGraphEdgeData struct {
	From     string `json:"from"`
	To       string `json:"to"`
	Relation string `json:"relation"`
}

type KnowledgeGraphEvidenceData struct {
	URL     string `json:"url,omitempty"`
	Snippet string `json:"snippet,omitempty"`
	Query   string `json:"query,omitempty"`
}

type KnowledgeGraphNodeData struct {
	ID              string                       `json:"id"`
	Label           string                       `json:"label"`
	NodeKind        string                       `json:"node_kind"`
	Type            string                       `json:"type"`
	Layer           int                          `json:"layer"`
	Relation        string                       `json:"relation,omitempty"`
	PlacementValue  string                       `json:"placement_value,omitempty"`
	ProductFitScore int                          `json:"product_fit_score"`
	SelectedForScan bool                         `json:"selected_for_scan"`
	RelevanceTags   []string                     `json:"relevance_tags"`
	RecencyTags     []string                     `json:"recency_tags"`
	Evidence        []KnowledgeGraphEvidenceData `json:"evidence,omitempty"`
}

type KnowledgeGraphNodeUpdate struct {
	NodeID          string   `json:"node_id" validate:"required"`
	SelectedForScan *bool    `json:"selected_for_scan,optional"`
	RelevanceTags   []string `json:"relevance_tags,optional"`
	RecencyTags     []string `json:"recency_tags,optional"`
}

type KnowledgeSourceData struct {
	ID           string `json:"id"`
	PersonaID    string `json:"persona_id"`
	SourceType   string `json:"source_type"`
	Title        string `json:"title,omitempty"`
	Filename     string `json:"filename,omitempty"`
	ParsedStatus string `json:"parsed_status,omitempty"`
	ChunkCount   int    `json:"chunk_count,omitempty"`
	CreateAt     int64  `json:"create_at"`
}

type ListBrandProductsData struct {
	List []BrandProductData `json:"list"`
}

type ListBrandScanPostsData struct {
	List  []ScanPostData `json:"list"`
	Total int            `json:"total"`
}

type ListBrandScanPostsHandlerReq struct {
	BrandPath
	ListBrandScanPostsReq
}

type ListBrandScanPostsReq struct {
	Priority      string `form:"priority,optional"`
	Recent7d      bool   `form:"recent_7d,optional"`
	ProductFitMin int    `form:"product_fit_min,optional"`
	Limit         int    `form:"limit,optional"`
}

type ListBrandsData struct {
	List []BrandData `json:"list"`
}

type ListContentFormulasData struct {
	Pagination PaginationData       `json:"pagination"`
	List       []ContentFormulaData `json:"list"`
}

type ListContentFormulasHandlerReq struct {
	ThreadsAccountPath
	ListContentFormulasReq
}

type ListContentFormulasReq struct {
	Page       int64  `form:"page,optional"`
	PageSize   int64  `form:"pageSize,optional"`
	SourceType string `form:"source_type,optional"`
	Tag        string `form:"tag,optional"`
}

type ListContentPlansData struct {
	List []ContentPlanData `json:"list"`
}

type ListCopyMissionCopyDraftsData struct {
	List  []CopyDraftData `json:"list"`
	Total int             `json:"total"`
}

type ListCopyMissionScanPostsHandlerReq struct {
	CopyMissionPath
	ListCopyMissionScanPostsReq
}

type ListCopyMissionScanPostsReq struct {
	Limit int `form:"limit,optional"`
}

type ListCopyMissionsData struct {
	List []CopyMissionData `json:"list"`
}

type ListFormulaPoolsData struct {
	List []FormulaPoolData `json:"list"`
}

type ListJobEventsReq struct {
	ID    string `path:"id" validate:"required"` // job run id
	Limit int64  `form:"limit,optional"`         // max events
}

type ListJobSchedulesReq struct {
	Scope    string `form:"scope,optional"`    // filter by scope
	ScopeID  string `form:"scope_id,optional"` // filter by scope id
	Page     int64  `form:"page,optional"`     // page number starting at 1
	PageSize int64  `form:"pageSize,optional"` // page size
}

type ListJobsReq struct {
	Scope    string `form:"scope,optional"`    // filter by scope
	ScopeID  string `form:"scope_id,optional"` // filter by scope id
	Page     int64  `form:"page,optional"`     // page number starting at 1
	PageSize int64  `form:"pageSize,optional"` // page size
}

type ListKnowledgeChunksData struct {
	List []KnowledgeChunkData `json:"list"`
}

type ListKnowledgeSourcesData struct {
	List []KnowledgeSourceData `json:"list"`
}

type ListMentionInboxData struct {
	List           []MentionInboxItemData `json:"list"`
	Pagination     PaginationData         `json:"pagination"`
	ReadyTotal     int64                  `json:"ready_total"`
	NewestSyncedAt int64                  `json:"newest_synced_at,omitempty"`
}

type ListMentionInboxHandlerReq struct {
	ThreadsAccountPath
	ListMentionInboxQuery
}

type ListMentionInboxQuery struct {
	Page     int `form:"page,optional"`
	PageSize int `form:"pageSize,optional"`
}

type ListOwnPostFormulasData struct {
	List []OwnPostFormulaReviewData `json:"list"`
}

type ListOwnPostFormulasHandlerReq struct {
	ThreadsAccountPath
}

type ListPersonaContentInboxData struct {
	Pagination PaginationData         `json:"pagination"`
	List       []ContentInboxItemData `json:"list"`
}

type ListPersonaContentInboxHandlerReq struct {
	PersonaPath
	ListPersonaContentInboxReq
}

type ListPersonaContentInboxReq struct {
	Page       int64  `form:"page,optional"`
	PageSize   int64  `form:"pageSize,optional"`
	Status     string `form:"status,optional"`
	RangeStart int64  `form:"rangeStart,optional"`
	RangeEnd   int64  `form:"rangeEnd,optional"`
}

type ListPersonaCopyDraftsData struct {
	List  []CopyDraftData `json:"list"`
	Total int             `json:"total"`
}

type ListPersonaViralScanPostsData struct {
	List  []ViralScanPostData `json:"list"`
	Total int                 `json:"total"`
}

type ListPersonaViralScanPostsHandlerReq struct {
	PersonaPath
	ListPersonaViralScanPostsReq
}

type ListPersonaViralScanPostsReq struct {
	Limit int `form:"limit,optional"`
}

type ListPersonasData struct {
	List []PersonaData `json:"list"`
}

type ListPlacementTopicScanPostsHandlerReq struct {
	PlacementTopicPath
	ListBrandScanPostsReq
}

type ListPlacementTopicsData struct {
	List []PlacementTopicData `json:"list"`
}

type ListPublishQueueHandlerReq struct {
	ThreadsAccountPath
	ListPublishQueueQuery
}

type ListPublishQueueQuery struct {
	Status   string `form:"status,optional"`
	Page     int    `form:"page,optional"`
	PageSize int    `form:"pageSize,optional"`
}

type ListStylePresetsData struct {
	List []StylePresetData `json:"list"`
}

type ListThreadsAccountAiProviderModelsReq struct {
	ApiKey string `json:"api_key,optional"` // 選填；未帶則用已儲存的 key
}

type ListThreadsAccountsData struct {
	List            []ThreadsAccountData `json:"list"`
	ActiveAccountID string               `json:"active_account_id"`
}

type ListThreadsOAuthLogsData struct {
	List []ThreadsOAuthLogItem `json:"list"`
}

type ListThreadsPostPerformanceHandlerReq struct {
	ThreadsAccountPath
	ListThreadsPostPerformanceQuery
}

type ListThreadsPostPerformanceQuery struct {
	Limit int `form:"limit,optional"`
}

type ListThreadsPublishHealthHandlerReq struct {
	ThreadsAccountPath
	ListThreadsPublishHealthQuery
}

type ListThreadsPublishHealthQuery struct {
	Page     int `form:"page,optional"`
	PageSize int `form:"pageSize,optional"`
}

type ListTopicCandidatesData struct {
	List []TopicCandidateData `json:"list"`
}

type LogoutData struct {
	OK bool `json:"ok"`
}

type MePermissionsData struct {
	UID         string            `json:"uid"`
	TenantID    string            `json:"tenant_id"`
	Roles       []string          `json:"roles"`
	Permissions map[string]string `json:"permissions"`
	Tree        []PermissionNode  `json:"tree,omitempty"`
}

type MePermissionsQuery struct {
	IncludeTree bool `form:"include_tree,optional"`
}

type MemberCapabilitiesData struct {
	DiscoverReady          bool   `json:"discover_ready"`
	AiReady                bool   `json:"ai_ready"`
	PublishReady           bool   `json:"publish_ready"`
	DiscoverHint           string `json:"discover_hint,omitempty"`
	AiHint                 string `json:"ai_hint,omitempty"`
	PublishHint            string `json:"publish_hint,omitempty"`
	ActiveThreadsAccountId string `json:"active_threads_account_id,omitempty"`
}

type MemberMeData struct {
	TenantID              string   `json:"tenant_id"`
	UID                   string   `json:"uid"`
	Email                 string   `json:"email"`
	DisplayName           string   `json:"display_name,omitempty"`
	Avatar                string   `json:"avatar,omitempty"`
	Phone                 string   `json:"phone,omitempty"`
	Language              string   `json:"language,omitempty"`
	Currency              string   `json:"currency,omitempty"`
	Status                string   `json:"status"`
	Origin                string   `json:"origin"`
	Roles                 []string `json:"roles,omitempty"`
	BusinessEmail         string   `json:"business_email,omitempty"`
	BusinessEmailVerified bool     `json:"business_email_verified"`
	BusinessPhone         string   `json:"business_phone,omitempty"`
	BusinessPhoneVerified bool     `json:"business_phone_verified"`
	CreateAt              int64    `json:"create_at"`
	UpdateAt              int64    `json:"update_at"`
}

type MemberPlacementSettingsData struct {
	WebSearchProvider     string `json:"web_search_provider"` // brave | exa
	BraveAPIKey           string `json:"brave_api_key,omitempty"`
	BraveAPIKeyConfigured bool   `json:"brave_api_key_configured"`
	ExaAPIKey             string `json:"exa_api_key,omitempty"`
	ExaAPIKeyConfigured   bool   `json:"exa_api_key_configured"`
	BraveCountry          string `json:"brave_country"`
	BraveSearchLang       string `json:"brave_search_lang"`
	ExaUserLocation       string `json:"exa_user_location"`
	ExpandStrategy        string `json:"expand_strategy"` // brave | llm | hybrid
	DevModeEnabled        bool   `json:"dev_mode_enabled"`
}

type MentionInboxItemData struct {
	MediaID         string `json:"media_id"`
	AuthorUsername  string `json:"author_username,omitempty"`
	Text            string `json:"text,omitempty"`
	Permalink       string `json:"permalink,omitempty"`
	Shortcode       string `json:"shortcode,omitempty"`
	Timestamp       string `json:"timestamp,omitempty"`
	MediaType       string `json:"media_type,omitempty"`
	IsReply         bool   `json:"is_reply"`
	IsQuotePost     bool   `json:"is_quote_post"`
	HasReplies      bool   `json:"has_replies"`
	RootPostID      string `json:"root_post_id,omitempty"`
	ParentID        string `json:"parent_id,omitempty"`
	ThreadPostText  string `json:"thread_post_text,omitempty"`
	ParentReplyText string `json:"parent_reply_text,omitempty"`
	ReplyReady      bool   `json:"reply_ready"`
	ReplyReadyMsg   string `json:"reply_ready_msg,omitempty"`
	SyncedAt        int64  `json:"synced_at"`
}

type OutreachDraftItemData struct {
	Text      string `json:"text"`
	Angle     string `json:"angle"`
	Rationale string `json:"rationale"`
}

type OwnPostFormulaReviewData struct {
	MediaID         string   `json:"media_id"`
	ReviewedAt      int64    `json:"reviewed_at"`
	FromCache       bool     `json:"from_cache,omitempty"`
	Summary         string   `json:"summary"`
	Wins            []string `json:"wins"`
	Improvements    []string `json:"improvements"`
	Formula         string   `json:"formula"`
	PostTemplate    string   `json:"post_template"`
	HookPattern     string   `json:"hook_pattern"`
	Structure       string   `json:"structure"`
	ReplicationTips []string `json:"replication_tips"`
	Avoid           []string `json:"avoid"`
}

type PaginationData struct {
	Total      int64 `json:"total"`
	Page       int64 `json:"page"`
	PageSize   int64 `json:"pageSize"`
	TotalPages int64 `json:"totalPages"`
}

type PatchAudienceSampleHandlerReq struct {
	CopyMissionSimilarAccountPath
	PatchAudienceSampleReq
}

type PatchAudienceSampleReq struct {
	Status string `json:"status"`
}

type PatchContentFormulaHandlerReq struct {
	ContentFormulaItemPath
	PatchContentFormulaReq
}

type PatchContentFormulaReq struct {
	Label        *string  `json:"label,optional"`
	Formula      *string  `json:"formula,optional"`
	PostTemplate *string  `json:"post_template,optional"`
	HookPattern  *string  `json:"hook_pattern,optional"`
	Structure    *string  `json:"structure,optional"`
	Tags         []string `json:"tags,optional"`
}

type PatchCopyMissionGraphNodesHandlerReq struct {
	CopyMissionPath
	PatchKnowledgeGraphNodesReq
}

type PatchKnowledgeGraphNodesHandlerReq struct {
	BrandPath
	PatchKnowledgeGraphNodesReq
}

type PatchKnowledgeGraphNodesReq struct {
	Updates []KnowledgeGraphNodeUpdate `json:"updates" validate:"required"`
}

type PatchPlacementTopicGraphNodesHandlerReq struct {
	PlacementTopicPath
	PatchKnowledgeGraphNodesReq
}

type PatchPlacementTopicScanPostOutreachHandlerReq struct {
	PlacementTopicPath
	PostID string `path:"postId"`
	PatchScanPostOutreachReq
}

type PatchPublishQueueHandlerReq struct {
	PublishQueueItemPath
	PatchPublishQueueReq
}

type PatchPublishQueueReq struct {
	Text        *string `json:"text,optional"`
	TopicTag    *string `json:"topic_tag,optional"`
	ScheduledAt *int64  `json:"scheduled_at,optional"`
}

type PatchScanPostOutreachHandlerReq struct {
	BrandPath
	PostID string `path:"postId"`
	PatchScanPostOutreachReq
}

type PatchScanPostOutreachReq struct {
	OutreachStatus *string `json:"outreach_status,optional"`
}

type PatchSimilarAccountHandlerReq struct {
	CopyMissionSimilarAccountPath
	PatchSimilarAccountReq
}

type PatchSimilarAccountReq struct {
	Status string `json:"status"`
}

type PermissionCatalogData struct {
	Tree []PermissionNode `json:"tree,omitempty"`
	List []PermissionNode `json:"list,omitempty"`
}

type PermissionCatalogQuery struct {
	Status string `form:"status,optional" validate:"omitempty,oneof=open close"`
	Type   string `form:"type,optional" validate:"omitempty,oneof=backend_user frontend_user"`
	Tree   bool   `form:"tree,optional"`
}

type PermissionNode struct {
	ID          string           `json:"id"`
	Parent      string           `json:"parent,omitempty"`
	Name        string           `json:"name"`
	HTTPMethods string           `json:"http_methods,omitempty"`
	HTTPPath    string           `json:"http_path,omitempty"`
	Status      string           `json:"status"`
	Type        string           `json:"type"`
	Children    []PermissionNode `json:"children,omitempty"`
}

type PersonaCopyMissionsPath struct {
	PersonaID string `path:"personaId" validate:"required"`
}

type PersonaData struct {
	ID              string              `json:"id"`
	DisplayName     string              `json:"display_name,omitempty"`
	Persona         string              `json:"persona,omitempty"`
	Brief           string              `json:"brief,omitempty"`
	StyleProfile    string              `json:"style_profile,omitempty"`
	StyleBenchmark  string              `json:"style_benchmark,omitempty"`
	SeedQuery       string              `json:"seed_query,omitempty"`
	CopyResearchMap CopyResearchMapData `json:"copy_research_map,omitempty"`
	CreateAt        int64               `json:"create_at"`
	UpdateAt        int64               `json:"update_at"`
}

type PersonaPath struct {
	ID string `path:"id" validate:"required"`
}

type PlacementTopicData struct {
	ID               string          `json:"id"`
	BrandID          string          `json:"brand_id"`
	BrandDisplayName string          `json:"brand_display_name,omitempty"`
	TopicName        string          `json:"topic_name,omitempty"`
	SeedQuery        string          `json:"seed_query,omitempty"`
	Brief            string          `json:"brief,omitempty"`
	ProductID        string          `json:"product_id,omitempty"`
	ResearchMap      ResearchMapData `json:"research_map,omitempty"`
	CreateAt         int64           `json:"create_at"`
	UpdateAt         int64           `json:"update_at"`
}

type PlacementTopicPath struct {
	ID string `path:"id" validate:"required"`
}

type PrunePersonaCopyDraftsData struct {
	Deleted int64  `json:"deleted"`
	Kept    int    `json:"kept"`
	Message string `json:"message"`
}

type PrunePersonaCopyDraftsHandlerReq struct {
	PersonaPath
	PrunePersonaCopyDraftsReq
}

type PrunePersonaCopyDraftsReq struct {
	Keep int `json:"keep,optional"`
}

type PublishAlertData struct {
	Type      string `json:"type"`
	Severity  string `json:"severity"`
	Message   string `json:"message"`
	QueueID   string `json:"queue_id,omitempty"`
	AccountID string `json:"account_id"`
	CreateAt  int64  `json:"create_at"`
}

type PublishAlertsData struct {
	List []PublishAlertData `json:"list"`
}

type PublishCopyDraftData struct {
	DraftID   string `json:"draft_id"`
	MediaID   string `json:"media_id"`
	Permalink string `json:"permalink,omitempty"`
	Status    string `json:"status"`
	Message   string `json:"message"`
}

type PublishCopyDraftHandlerReq struct {
	CopyDraftPath
	PublishCopyDraftReq
}

type PublishCopyDraftReq struct {
	Text     string `json:"text,optional"`
	TopicTag string `json:"topic_tag,optional"`
	Confirm  bool   `json:"confirm"`
}

type PublishDashboardAccountSummary struct {
	AccountID        string `json:"account_id"`
	AccountName      string `json:"account_name"`
	PendingScheduled int64  `json:"pending_scheduled"`
	FailedCount      int64  `json:"failed_count"`
	Published7d      int64  `json:"published_7d"`
	TotalLikes7d     int    `json:"total_likes_7d"`
	TotalReplies7d   int    `json:"total_replies_7d"`
	Paused           bool   `json:"paused"`
	BestSlot         string `json:"best_slot,omitempty"`
	LowSlot          string `json:"low_slot,omitempty"`
}

type PublishDashboardSummaryData struct {
	List             []PublishDashboardAccountSummary `json:"list"`
	TotalPending     int64                            `json:"total_pending"`
	TotalFailed      int64                            `json:"total_failed"`
	TotalPublished7d int64                            `json:"total_published_7d"`
	TotalLikes7d     int                              `json:"total_likes_7d"`
	TotalReplies7d   int                              `json:"total_replies_7d"`
}

type PublishGuardPolicyData struct {
	AccountID                    string `json:"account_id"`
	Enabled                      bool   `json:"enabled"`
	MaxDailyPosts                int    `json:"max_daily_posts"`
	MinIntervalMinutes           int    `json:"min_interval_minutes"`
	ConsecutiveFailurePauseLimit int    `json:"consecutive_failure_pause_limit"`
	Paused                       bool   `json:"paused"`
	PausedReason                 string `json:"paused_reason,omitempty"`
	UpdateAt                     int64  `json:"update_at"`
}

type PublishInventoryPolicyData struct {
	AccountID         string                 `json:"account_id"`
	Enabled           bool                   `json:"enabled"`
	TargetDailyCount  int                    `json:"target_daily_count"`
	LowStockThreshold int                    `json:"low_stock_threshold"`
	LookaheadDays     int                    `json:"lookahead_days"`
	Timezone          string                 `json:"timezone"`
	Slots             []PublishSlotData      `json:"slots"`
	SourceRefs        []PublishSourceRefData `json:"source_refs"`
	UpdateAt          int64                  `json:"update_at"`
}

type PublishMentionReplyData struct {
	MediaID   string `json:"media_id,omitempty"`
	Permalink string `json:"permalink,omitempty"`
}

type PublishMentionReplyHandlerReq struct {
	PublishMentionReplyPath
	PublishMentionReplyReq
}

type PublishMentionReplyPath struct {
	ID      string `path:"id" validate:"required"`
	MediaID string `path:"media_id" validate:"required"`
}

type PublishMentionReplyReq struct {
	Text string `json:"text"`
}

type PublishOutreachDraftData struct {
	ScanPostID         string `json:"scan_post_id"`
	ReplyID            string `json:"reply_id"`
	Permalink          string `json:"permalink"`
	OutreachStatus     string `json:"outreach_status"`
	PublishedPermalink string `json:"published_permalink"`
	Message            string `json:"message"`
}

type PublishOutreachDraftHandlerReq struct {
	BrandPath
	PublishOutreachDraftReq
}

type PublishOutreachDraftReq struct {
	ScanPostID string `json:"scan_post_id" validate:"required"`
	Text       string `json:"text" validate:"required"`
	Confirm    bool   `json:"confirm"`
}

type PublishPlacementTopicOutreachDraftHandlerReq struct {
	PlacementTopicPath
	PublishOutreachDraftReq
}

type PublishQueueEventData struct {
	ID         string `json:"id"`
	QueueID    string `json:"queue_id"`
	EventType  string `json:"event_type"`
	FromStatus string `json:"from_status,omitempty"`
	ToStatus   string `json:"to_status,omitempty"`
	Message    string `json:"message,omitempty"`
	CreateAt   int64  `json:"create_at"`
}

type PublishQueueEventsData struct {
	List []PublishQueueEventData `json:"list"`
}

type PublishQueueItemData struct {
	ID            string `json:"id"`
	AccountID     string `json:"account_id"`
	PersonaID     string `json:"persona_id,omitempty"`
	CopyMissionID string `json:"copy_mission_id,omitempty"`
	CopyDraftID   string `json:"copy_draft_id,omitempty"`
	Text          string `json:"text"`
	TopicTag      string `json:"topic_tag,omitempty"`
	ScheduledAt   int64  `json:"scheduled_at"`
	Status        string `json:"status"`
	MediaID       string `json:"media_id,optional"`
	Permalink     string `json:"permalink,optional"`
	PublishedAt   int64  `json:"published_at,optional"`
	ErrorMessage  string `json:"error_message,optional"`
	RetryCount    int    `json:"retry_count,omitempty"`
	LastAttemptAt int64  `json:"last_attempt_at,omitempty"`
	NextAttemptAt int64  `json:"next_attempt_at,omitempty"`
	MissedAt      int64  `json:"missed_at,omitempty"`
	PausedReason  string `json:"paused_reason,omitempty"`
	CreateAt      int64  `json:"create_at"`
	UpdateAt      int64  `json:"update_at"`
}

type PublishQueueItemPath struct {
	ID  string `path:"id" validate:"required"`
	QID string `path:"qid" validate:"required"`
}

type PublishQueueListData struct {
	Pagination PaginationData         `json:"pagination"`
	List       []PublishQueueItemData `json:"list"`
}

type PublishQueueRangeHandlerReq struct {
	ThreadsAccountPath
	PublishQueueRangeQuery
}

type PublishQueueRangeQuery struct {
	StartAt int64  `form:"startAt,optional"`
	EndAt   int64  `form:"endAt,optional"`
	Status  string `form:"status,optional"`
}

type PublishSlotData struct {
	Weekday int    `json:"weekday"`
	Time    string `json:"time"`
}

type PublishSlotInsightData struct {
	Weekday        int    `json:"weekday"`
	Time           string `json:"time"`
	AvgLikes1h     int    `json:"avg_likes_1h"`
	AvgReplies1h   int    `json:"avg_replies_1h"`
	AvgLikes24h    int    `json:"avg_likes_24h"`
	AvgReplies24h  int    `json:"avg_replies_24h"`
	AvgLikes7d     int    `json:"avg_likes_7d"`
	AvgReplies7d   int    `json:"avg_replies_7d"`
	SampleSize     int    `json:"sample_size"`
	Recommendation string `json:"recommendation"`
}

type PublishSlotInsightsData struct {
	AccountID string                   `json:"account_id"`
	Timezone  string                   `json:"timezone"`
	Slots     []PublishSlotInsightData `json:"slots"`
}

type PublishSourceRefData struct {
	Type          string `json:"type"`
	PersonaID     string `json:"persona_id,omitempty"`
	CopyMissionID string `json:"copy_mission_id,omitempty"`
	ScanPostID    string `json:"scan_post_id,omitempty"`
	ManualSeed    string `json:"manual_seed,omitempty"`
}

type ResearchItemData struct {
	Title   string `json:"title,omitempty"`
	URL     string `json:"url,omitempty"`
	Snippet string `json:"snippet,omitempty"`
	Query   string `json:"query,omitempty"`
}

type ResearchMapData struct {
	AudienceSummary string             `json:"audience_summary,omitempty"`
	ContentGoal     string             `json:"content_goal,omitempty"`
	Questions       []string           `json:"questions,omitempty"`
	Pillars         []string           `json:"pillars,omitempty"`
	Exclusions      []string           `json:"exclusions,omitempty"`
	ResearchItems   []ResearchItemData `json:"research_items,omitempty"`
	ExpandStrategy  string             `json:"expand_strategy,omitempty"`
	PatrolKeywords  []string           `json:"patrol_keywords,omitempty"`
}

type RunThreadsAPIPlaygroundHandlerReq struct {
	ThreadsAccountPath
	RunThreadsAPIPlaygroundReq
}

type RunThreadsAPIPlaygroundReq struct {
	Action        string `json:"action" validate:"required"`
	Query         string `json:"query,optional"`
	Username      string `json:"username,optional"`
	MediaID       string `json:"media_id,optional"`
	ReplyID       string `json:"reply_id,optional"`
	ReplyToID     string `json:"reply_to_id,optional"`
	Text          string `json:"text,optional"`
	Permalink     string `json:"permalink,optional"`
	HintText      string `json:"hint_text,optional"`
	SkipPrime     bool   `json:"skip_prime,optional"`
	LocationQuery string `json:"location_query,optional"`
	Limit         int    `json:"limit,optional"`
	Hide          bool   `json:"hide,optional"`
	SearchType    string `json:"search_type,optional"`
}

type RunThreadsAPISmokeTestData struct {
	List    []ThreadsAPISmokeTestItem `json:"list"`
	Passed  int                       `json:"passed"`
	Failed  int                       `json:"failed"`
	Skipped int                       `json:"skipped"`
	Total   int                       `json:"total"`
}

type ScanPostData struct {
	ID                 string                      `json:"id"`
	GraphNodeID        string                      `json:"graph_node_id"`
	SearchTag          string                      `json:"search_tag"`
	QueryDimension     string                      `json:"query_dimension"`
	ExternalID         string                      `json:"external_id"`
	Permalink          string                      `json:"permalink"`
	Author             string                      `json:"author"`
	Text               string                      `json:"text"`
	Priority           string                      `json:"priority"`
	PlacementScore     int                         `json:"placement_score"`
	ProductFitScore    int                         `json:"product_fit_score"`
	SolvedByProduct    bool                        `json:"solved_by_product"`
	Source             string                      `json:"source"`
	ScanJobID          string                      `json:"scan_job_id"`
	OutreachStatus     string                      `json:"outreach_status,omitempty"`
	PublishedReplyID   string                      `json:"published_reply_id,omitempty"`
	PublishedPermalink string                      `json:"published_permalink,omitempty"`
	OutreachUpdateAt   int64                       `json:"outreach_update_at,omitempty"`
	PostedAt           string                      `json:"posted_at,omitempty"`
	RecencyDays        int                         `json:"recency_days,omitempty"`
	Replies            []ScanReplyData             `json:"replies,omitempty"`
	LatestDraft        *GenerateOutreachDraftsData `json:"latest_draft,omitempty"`
	CreateAt           int64                       `json:"create_at"`
}

type ScanReplyData struct {
	ExternalID string `json:"external_id,omitempty"`
	Author     string `json:"author,omitempty"`
	Text       string `json:"text"`
	Permalink  string `json:"permalink,omitempty"`
	LikeCount  int    `json:"like_count,omitempty"`
	PostedAt   string `json:"posted_at,omitempty"`
}

type ScheduleCopyDraftsData struct {
	Scheduled int                    `json:"scheduled"`
	List      []PublishQueueItemData `json:"list"`
	Message   string                 `json:"message"`
}

type ScheduleCopyDraftsReq struct {
	AccountID string            `json:"account_id" validate:"required"`
	DraftIDs  []string          `json:"draft_ids" validate:"required,min=1"`
	StartAt   int64             `json:"start_at,optional"`
	Timezone  string            `json:"timezone,optional"`
	Slots     []PublishSlotData `json:"slots,optional"`
	Mode      string            `json:"mode,optional"`
}

type ScheduleCopyMissionDraftsHandlerReq struct {
	CopyMissionPath
	CopyMissionScheduleCopyDraftsReq
}

type SchedulePersonaCopyDraftHandlerReq struct {
	CopyDraftPath
	SchedulePersonaCopyDraftReq
}

type SchedulePersonaCopyDraftReq struct {
	AccountID   string `json:"account_id" validate:"required"`
	TopicTag    string `json:"topic_tag,optional"`
	ScheduledAt int64  `json:"scheduled_at,optional"`
}

type SchedulePersonaDraftsHandlerReq struct {
	PersonaPath
	ScheduleCopyDraftsReq
}

type SearchContentFormulaPostsData struct {
	List    []ContentFormulaSearchPostData `json:"list"`
	Message string                         `json:"message"`
}

type SearchContentFormulaPostsHandlerReq struct {
	ThreadsAccountPath
	SearchContentFormulaPostsReq
}

type SearchContentFormulaPostsReq struct {
	Keyword    string `json:"keyword" validate:"required"`
	SearchType string `json:"search_type,optional"`
	Limit      int    `json:"limit,optional"`
}

type SettingData struct {
	ID       string                 `json:"id"`
	Scope    string                 `json:"scope"`
	ScopeID  string                 `json:"scope_id"`
	Key      string                 `json:"key"`
	Value    map[string]interface{} `json:"value"`
	Version  int                    `json:"version"`
	CreateAt int64                  `json:"create_at"`
	UpdateAt int64                  `json:"update_at"`
}

type SettingKeyPath struct {
	Scope   string `path:"scope" validate:"required,oneof=user account system"` // 設定範圍，可選 user / account / system
	ScopeID string `path:"scope_id" validate:"required"`                        // 範圍 ID，例如 user_id、account_id 或 global
	Key     string `path:"key" validate:"required"`                             // 設定 key，例如 ai.default
}

type SettingListData struct {
	Pagination PaginationData `json:"pagination"`
	List       []SettingData  `json:"list"`
}

type SettingPath struct {
	Scope    string `path:"scope" validate:"required,oneof=user account system"` // 設定範圍，可選 user / account / system
	ScopeID  string `path:"scope_id" validate:"required"`                        // 範圍 ID，例如 user_id、account_id 或 global
	Page     int64  `form:"page,optional"`                                       // 頁碼，從 1 開始
	PageSize int64  `form:"pageSize,optional"`                                   // 每頁筆數，server 會限制最大值
}

type SettingUpsertReq struct {
	Scope   string                 `path:"scope" validate:"required,oneof=user account system"` // 設定範圍，可選 user / account / system
	ScopeID string                 `path:"scope_id" validate:"required"`                        // 範圍 ID，例如 user_id、account_id 或 global
	Key     string                 `path:"key" validate:"required"`                             // 設定 key，例如 ai.default
	Value   map[string]interface{} `json:"value" validate:"required"`                           // 設定內容 JSON object
	Version int                    `json:"version,optional"`                                    // schema version，未帶入時預設 1
}

type StartBrandScanJobData struct {
	JobID   string `json:"job_id"`
	Status  string `json:"status"`
	Message string `json:"message"`
}

type StartBrandScanJobHandlerReq struct {
	BrandPath
	StartBrandScanJobReq
}

type StartBrandScanJobReq struct {
	GraphID        string   `json:"graph_id,optional"`
	NodeIDs        []string `json:"node_ids,optional"`
	DualTrack      bool     `json:"dual_track,optional"`
	PatrolMode     bool     `json:"patrol_mode,optional"`
	TestPatrol     bool     `json:"test_patrol,optional"`
	PatrolKeywords []string `json:"patrol_keywords,optional"`
}

type StartCopyMissionAnalyzeJobData struct {
	JobID   string `json:"job_id"`
	Status  string `json:"status"`
	Message string `json:"message"`
}

type StartCopyMissionCopyDraftJobData struct {
	JobID   string `json:"job_id"`
	Status  string `json:"status"`
	Message string `json:"message"`
}

type StartCopyMissionCopyDraftJobHandlerReq struct {
	CopyMissionPath
	StartCopyMissionCopyDraftJobReq
}

type StartCopyMissionCopyDraftJobReq struct {
	ScanPostID string `json:"scan_post_id" validate:"required"`
}

type StartCopyMissionMatrixJobData struct {
	JobID   string `json:"job_id"`
	Status  string `json:"status"`
	Message string `json:"message"`
}

type StartCopyMissionMatrixJobHandlerReq struct {
	CopyMissionPath
	StartCopyMissionMatrixJobReq
}

type StartCopyMissionMatrixJobReq struct {
	Count int `json:"count,optional"`
}

type StartCopyMissionScanJobData struct {
	JobID   string `json:"job_id"`
	Status  string `json:"status"`
	Message string `json:"message"`
}

type StartPersonaFormulaDraftJobData struct {
	JobID      string `json:"job_id"`
	Status     string `json:"status"`
	AiProvider string `json:"ai_provider"`
	AiModel    string `json:"ai_model"`
	Message    string `json:"message"`
}

type StartPersonaFormulaDraftJobHandlerReq struct {
	PersonaPath
	StartPersonaFormulaDraftJobReq
}

type StartPersonaFormulaDraftJobReq struct {
	AccountID    string `json:"account_id" validate:"required"`
	FormulaID    string `json:"formula_id" validate:"required"`
	Topic        string `json:"topic" validate:"required"`
	Brief        string `json:"brief,optional"`
	UseWebSearch bool   `json:"use_web_search,optional"`
	DraftCount   int    `json:"draft_count,optional"`
}

type StartPersonaRewriteDraftJobData struct {
	JobID      string `json:"job_id"`
	Status     string `json:"status"`
	AiProvider string `json:"ai_provider"`
	AiModel    string `json:"ai_model"`
	Message    string `json:"message"`
}

type StartPersonaRewriteDraftJobHandlerReq struct {
	PersonaPath
	StartPersonaRewriteDraftJobReq
}

type StartPersonaRewriteDraftJobReq struct {
	AccountID     string `json:"account_id" validate:"required"`
	ReferenceText string `json:"reference_text" validate:"required"`
	Topic         string `json:"topic" validate:"required"`
	Brief         string `json:"brief,optional"`
	SaveLabel     string `json:"save_label,optional"`
	UseWebSearch  bool   `json:"use_web_search,optional"`
	DraftCount    int    `json:"draft_count,optional"`
}

type StartPersonaStyleAnalysisData struct {
	JobID   string `json:"job_id"`
	Status  string `json:"status"`
	Message string `json:"message"`
}

type StartPersonaStyleAnalysisFromTextData struct {
	Persona   PersonaData `json:"persona"`
	PostCount int         `json:"post_count"`
	Message   string      `json:"message"`
}

type StartPersonaStyleAnalysisFromTextHandlerReq struct {
	PersonaPath
	StartPersonaStyleAnalysisFromTextReq
}

type StartPersonaStyleAnalysisFromTextReq struct {
	ReferenceTexts []string `json:"reference_texts,optional"`
	RawText        string   `json:"raw_text,optional"`
	SourceLabel    string   `json:"source_label,optional"`
}

type StartPersonaStyleAnalysisHandlerReq struct {
	PersonaPath
	StartPersonaStyleAnalysisReq
}

type StartPersonaStyleAnalysisReq struct {
	BenchmarkUsername string `json:"benchmark_username" validate:"required"`
}

type StartPersonaTopicMatrixJobData struct {
	JobID      string `json:"job_id"`
	Status     string `json:"status"`
	AiProvider string `json:"ai_provider"`
	AiModel    string `json:"ai_model"`
	Message    string `json:"message"`
}

type StartPersonaTopicMatrixJobHandlerReq struct {
	PersonaPath
	GeneratePersonaTopicMatrixReq
}

type StartPersonaViralScanJobData struct {
	JobID   string `json:"job_id"`
	Status  string `json:"status"`
	Message string `json:"message"`
}

type StartPersonaViralScanJobHandlerReq struct {
	PersonaPath
	StartPersonaViralScanJobReq
}

type StartPersonaViralScanJobReq struct {
	Keywords []string `json:"keywords,optional"`
}

type StartPlacementTopicOutreachDraftJobHandlerReq struct {
	PlacementTopicPath
	StartPlacementTopicOutreachDraftJobReq
}

type StartPlacementTopicOutreachDraftJobReq struct {
	ScanPostID     string   `json:"scan_post_id,optional"`
	ScanPostIDs    []string `json:"scan_post_ids,optional"`
	Count          int      `json:"count,optional"`
	VoicePersonaID string   `json:"voice_persona_id,optional"`
	ProductID      string   `json:"product_id,optional"`
	Regenerate     bool     `json:"regenerate,optional"`
}

type StartPlacementTopicOutreachDraftJobsData struct {
	Jobs    []StartBrandScanJobData `json:"jobs"`
	Message string                  `json:"message"`
}

type StartPlacementTopicScanJobHandlerReq struct {
	PlacementTopicPath
	StartBrandScanJobReq
}

type StartPublishInventoryRefillJobData struct {
	JobID   string `json:"job_id"`
	Status  string `json:"status"`
	Message string `json:"message"`
}

type StartPublishInventoryRefillJobHandlerReq struct {
	ThreadsAccountPath
	StartPublishInventoryRefillJobReq
}

type StartPublishInventoryRefillJobReq struct {
	Count int `json:"count,optional"`
}

type StartThreadsOAuthData struct {
	AuthorizeURL string `json:"authorize_url"`
	State        string `json:"state"`
	AccountID    string `json:"account_id"`
}

type StartThreadsOAuthQuery struct {
	AccountID string `form:"account_id,optional"`
}

type Status struct {
	Code    int64       `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,optional"`
	Error   ErrorDetail `json:"error,optional"`
}

type StorePersonaStyleProfileData struct {
	ID       string `json:"id"`
	UpdateAt int64  `json:"update_at"`
}

type StorePersonaStyleProfileReq struct {
	ID             string `path:"id" validate:"required"`
	TenantID       string `json:"tenant_id" validate:"required"`
	OwnerUID       string `json:"owner_uid" validate:"required"`
	StyleProfile   string `json:"style_profile" validate:"required"`
	StyleBenchmark string `json:"style_benchmark,optional"`
}

type StylePresetData struct {
	ID          string   `json:"id"`
	PersonaID   string   `json:"persona_id"`
	Name        string   `json:"name"`
	Tone        string   `json:"tone,omitempty"`
	CTA         []string `json:"cta,omitempty"`
	BannedWords []string `json:"banned_words,omitempty"`
	Notes       string   `json:"notes,omitempty"`
	CreateAt    int64    `json:"create_at"`
	UpdateAt    int64    `json:"update_at"`
}

type StylePresetPath struct {
	ID       string `path:"id" validate:"required"`
	PresetID string `path:"presetId" validate:"required"`
}

type SyncMentionInboxData struct {
	Synced int   `json:"synced"`
	Ready  int   `json:"ready"`
	Total  int64 `json:"total"`
}

type SyncMentionInboxHandlerReq struct {
	ThreadsAccountPath
	SyncMentionInboxReq
}

type SyncMentionInboxReq struct {
	Limit    int `json:"limit,optional"`
	MaxPages int `json:"max_pages,optional"`
}

type ThreadsAPIPlaygroundData struct {
	Action  string `json:"action"`
	Ok      bool   `json:"ok"`
	Message string `json:"message"`
	Data    string `json:"data,optional"`
}

type ThreadsAPISmokeTestItem struct {
	Scope   string `json:"scope"`
	Name    string `json:"name"`
	Status  string `json:"status"`
	Message string `json:"message"`
	Count   int    `json:"count"`
}

type ThreadsAccountAiProviderModelsData struct {
	ID      string   `json:"id"`
	Label   string   `json:"label"`
	Models  []string `json:"models"`
	Streams bool     `json:"streams"`
	Error   string   `json:"error,optional"`
}

type ThreadsAccountAiProviderModelsHandlerReq struct {
	ThreadsAccountAiProviderPath
	ListThreadsAccountAiProviderModelsReq
}

type ThreadsAccountAiProviderPath struct {
	ID       string `path:"id" validate:"required"`
	Provider string `path:"provider" validate:"required,oneof=opencode-go xai"`
}

type ThreadsAccountAiSettingsData struct {
	AccountID         string                 `json:"account_id"`
	Provider          string                 `json:"provider"`
	Model             string                 `json:"model"`
	ResearchProvider  string                 `json:"research_provider,omitempty"`
	ResearchModel     string                 `json:"research_model,omitempty"`
	ApiKeys           map[string]string      `json:"api_keys"`
	ApiKeysConfigured map[string]interface{} `json:"api_keys_configured"`
}

type ThreadsAccountConnectionData struct {
	AccountID        string                        `json:"account_id"`
	AccountName      string                        `json:"account_name"`
	Username         string                        `json:"username,omitempty"`
	BrowserConnected bool                          `json:"browser_connected"`
	ApiConnected     bool                          `json:"api_connected"`
	Prefs            ThreadsAccountConnectionPrefs `json:"prefs"`
}

type ThreadsAccountConnectionPrefs struct {
	SearchViaApi     bool   `json:"search_via_api"`
	SearchSourceMode string `json:"search_source_mode"`
	PublishViaApi    bool   `json:"publish_via_api"`
	DevMode          bool   `json:"dev_mode"`
	ScrapeReplies    bool   `json:"scrape_replies"`
	RepliesPerPost   int    `json:"replies_per_post"`
	PublishHeaded    bool   `json:"publish_headed"`
	PlaywrightDebug  bool   `json:"playwright_debug"`
}

type ThreadsAccountData struct {
	ID                string `json:"id"`
	DisplayName       string `json:"display_name,omitempty"`
	Username          string `json:"username,omitempty"`
	ThreadsUserID     string `json:"threads_user_id,omitempty"`
	PersonaID         string `json:"persona_id,omitempty"` // deprecated: persona is chosen per publish, not bound to account
	BrowserConnected  bool   `json:"browser_connected"`
	ApiConnected      bool   `json:"api_connected"`
	APITokenExpiresAt int64  `json:"api_token_expires_at,omitempty"`
	Status            string `json:"status"`
	CreateAt          int64  `json:"create_at"`
	UpdateAt          int64  `json:"update_at"`
}

type ThreadsAccountInsightsBlock struct {
	Status  string                     `json:"status"`
	Message string                     `json:"message,optional"`
	Metrics []ThreadsInsightMetricItem `json:"metrics,optional"`
}

type ThreadsAccountPath struct {
	ID string `path:"id" validate:"required"`
}

type ThreadsDiagnosticsData struct {
	AccountID      string                    `json:"account_id"`
	CheckedAt      int64                     `json:"checked_at"`
	ApiConnected   bool                      `json:"api_connected"`
	TokenExpiresAt int64                     `json:"token_expires_at,omitempty"`
	Scopes         []string                  `json:"scopes"`
	Items          []ThreadsAPISmokeTestItem `json:"items"`
	Message        string                    `json:"message"`
}

type ThreadsInsightMetricItem struct {
	Name  string `json:"name"`
	Value int    `json:"value"`
}

type ThreadsOAuthCallbackQuery struct {
	Code             string `form:"code,optional"`
	State            string `form:"state,optional"`
	Error            string `form:"error,optional"`
	ErrorReason      string `form:"error_reason,optional"`
	ErrorDescription string `form:"error_description,optional"`
}

type ThreadsOAuthConfigData struct {
	RedirectURI     string `json:"redirect_uri"`
	SuccessRedirect string `json:"success_redirect"`
	Enabled         bool   `json:"enabled"`
	RequiresHTTPS   bool   `json:"requires_https"`
}

type ThreadsOAuthLogItem struct {
	At        int64  `json:"at"`
	Level     string `json:"level"`
	Stage     string `json:"stage"`
	AccountID string `json:"account_id,omitempty"`
	Message   string `json:"message"`
}

type ThreadsPostMetricCapability struct {
	Scope     string   `json:"scope"`
	Name      string   `json:"name"`
	Metrics   []string `json:"metrics"`
	Trackable bool     `json:"trackable"`
	Note      string   `json:"note,optional"`
}

type ThreadsPostPerformanceData struct {
	AccountID       string                        `json:"account_id"`
	Username        string                        `json:"username,optional"`
	ThreadsUserID   string                        `json:"threads_user_id,optional"`
	FetchedAt       int64                         `json:"fetched_at"`
	Capabilities    []ThreadsPostMetricCapability `json:"capabilities"`
	AccountInsights ThreadsAccountInsightsBlock   `json:"account_insights"`
	Posts           []ThreadsPostPerformanceItem  `json:"posts"`
}

type ThreadsPostPerformanceItem struct {
	MediaID         string `json:"media_id"`
	Text            string `json:"text,optional"`
	Permalink       string `json:"permalink,optional"`
	Timestamp       string `json:"timestamp,optional"`
	MediaType       string `json:"media_type,optional"`
	MediaURL        string `json:"media_url,optional"`
	ThumbnailURL    string `json:"thumbnail_url,optional"`
	TopicTag        string `json:"topic_tag,optional"`
	Shortcode       string `json:"shortcode,optional"`
	LikeCount       int    `json:"like_count"`
	ReplyCount      int    `json:"reply_count"`
	RepostCount     int    `json:"repost_count,optional"`
	QuoteCount      int    `json:"quote_count,optional"`
	Views           int    `json:"views,optional"`
	Shares          int    `json:"shares,optional"`
	InsightsStatus  string `json:"insights_status,optional"`
	InsightsMessage string `json:"insights_message,optional"`
}

type ThreadsPublishHealthCheckpoint struct {
	Checkpoint  string `json:"checkpoint"`
	LikeCount   int    `json:"like_count"`
	ReplyCount  int    `json:"reply_count"`
	RepostCount int    `json:"repost_count"`
	QuoteCount  int    `json:"quote_count"`
	Views       int    `json:"views,optional"`
	CheckedAt   int64  `json:"checked_at"`
}

type ThreadsPublishHealthData struct {
	Summary    ThreadsPublishHealthSummary `json:"summary"`
	Pagination PaginationData              `json:"pagination"`
	List       []ThreadsPublishHealthItem  `json:"list"`
}

type ThreadsPublishHealthItem struct {
	MediaID     string                           `json:"media_id"`
	Permalink   string                           `json:"permalink,optional"`
	Text        string                           `json:"text,optional"`
	PublishedAt int64                            `json:"published_at"`
	LikeCount   int                              `json:"like_count"`
	ReplyCount  int                              `json:"reply_count"`
	RepostCount int                              `json:"repost_count,optional"`
	QuoteCount  int                              `json:"quote_count,optional"`
	Views       int                              `json:"views,optional"`
	Shares      int                              `json:"shares,optional"`
	Checkpoints []ThreadsPublishHealthCheckpoint `json:"checkpoints"`
}

type ThreadsPublishHealthSummary struct {
	PendingScheduled int64 `json:"pending_scheduled"`
	FailedCount      int64 `json:"failed_count"`
	Published7d      int64 `json:"published_7d"`
	TotalLikes7d     int   `json:"total_likes_7d"`
	TotalReplies7d   int   `json:"total_replies_7d"`
}

type TopicCandidateData struct {
	ID                  string   `json:"id"`
	PersonaID           string   `json:"persona_id"`
	Name                string   `json:"name"`
	Source              string   `json:"source,omitempty"`
	Category            string   `json:"category,omitempty"`
	SeedQuery           string   `json:"seed_query,omitempty"`
	TrendReason         string   `json:"trend_reason,omitempty"`
	TrendKeywords       []string `json:"trend_keywords,omitempty"`
	HeatScore           int      `json:"heat_score,omitempty"`
	FitScore            int      `json:"fit_score,omitempty"`
	InteractionScore    int      `json:"interaction_score,omitempty"`
	ExtendScore         int      `json:"extend_score,omitempty"`
	RiskScore           int      `json:"risk_score,omitempty"`
	FinalScore          float64  `json:"final_score,omitempty"`
	RecommendedMissions []string `json:"recommended_missions,omitempty"`
	Status              string   `json:"status,omitempty"`
	CreateAt            int64    `json:"create_at"`
	UpdateAt            int64    `json:"update_at"`
}

type UpdateBrandHandlerReq struct {
	BrandPath
	UpdateBrandReq
}

type UpdateBrandProductHandlerReq struct {
	BrandProductPath
	UpdateBrandProductReq
}

type UpdateBrandProductReq struct {
	Label          *string  `json:"label,optional"`
	ProductContext *string  `json:"product_context,optional"`
	PlacementURL   string   `json:"placement_url,optional"`
	MatchTags      []string `json:"match_tags,optional"`
}

type UpdateBrandReq struct {
	DisplayName     *string  `json:"display_name,optional"`
	TopicName       *string  `json:"topic_name,optional"`
	SeedQuery       *string  `json:"seed_query,optional"`
	Brief           *string  `json:"brief,optional"`
	ProductBrief    *string  `json:"product_brief,optional"`
	ProductContext  *string  `json:"product_context,optional"`
	ProductID       *string  `json:"product_id,optional"`
	TargetAudience  *string  `json:"target_audience,optional"`
	Goals           *string  `json:"goals,optional"`
	AudienceSummary *string  `json:"audience_summary,optional"`
	ContentGoal     *string  `json:"content_goal,optional"`
	Questions       []string `json:"questions,optional"`
	Pillars         []string `json:"pillars,optional"`
	Exclusions      []string `json:"exclusions,optional"`
	PatrolKeywords  []string `json:"patrol_keywords,optional"`
}

type UpdateContentPlanHandlerReq struct {
	ContentPlanPath
	UpdateContentPlanReq
}

type UpdateContentPlanReq struct {
	Topic               *string  `json:"topic,optional"`
	Mission             *string  `json:"mission,optional"`
	TargetAudience      *string  `json:"target_audience,optional"`
	Angle               *string  `json:"angle,optional"`
	OpeningType         *string  `json:"opening_type,optional"`
	BodyType            *string  `json:"body_type,optional"`
	Emotion             *string  `json:"emotion,optional"`
	EndingType          *string  `json:"ending_type,optional"`
	CtaType             *string  `json:"cta_type,optional"`
	RiskLevel           *string  `json:"risk_level,optional"`
	RequiresHumanReview *bool    `json:"requires_human_review,optional"`
	Avoid               []string `json:"avoid,optional"`
	SelectedKnowledge   []string `json:"selected_knowledge,optional"`
	Status              *string  `json:"status,optional"`
}

type UpdateCopyDraftHandlerReq struct {
	CopyDraftPath
	UpdateCopyDraftReq
}

type UpdateCopyDraftReq struct {
	Text      *string `json:"text,optional"`
	TopicTag  *string `json:"topic_tag,optional"`
	Hook      *string `json:"hook,optional"`
	Angle     *string `json:"angle,optional"`
	Rationale *string `json:"rationale,optional"`
	Status    *string `json:"status,optional"`
}

type UpdateCopyMissionHandlerReq struct {
	CopyMissionPath
	UpdateCopyMissionReq
}

type UpdateCopyMissionReq struct {
	Label                  *string  `json:"label,optional"`
	SeedQuery              *string  `json:"seed_query,optional"`
	Brief                  *string  `json:"brief,optional"`
	AudienceSummary        *string  `json:"audience_summary,optional"`
	ContentGoal            *string  `json:"content_goal,optional"`
	Questions              []string `json:"questions,optional"`
	Pillars                []string `json:"pillars,optional"`
	Exclusions             []string `json:"exclusions,optional"`
	KnowledgeItems         []string `json:"knowledge_items,optional"`
	SelectedKnowledgeItems []string `json:"selected_knowledge_items,optional"`
	BenchmarkNotes         *string  `json:"benchmark_notes,optional"`
	SelectedTags           []string `json:"selected_tags,optional"`
	Status                 *string  `json:"status,optional"`
}

type UpdateJobScheduleReq struct {
	ID              string                 `path:"id" validate:"required"`    // schedule id
	Cron            string                 `json:"cron,optional"`             // cron expression
	Timezone        string                 `json:"timezone,optional"`         // timezone
	PayloadTemplate map[string]interface{} `json:"payload_template,optional"` // payload template
	Enabled         *bool                  `json:"enabled,optional"`          // enabled flag
}

type UpdateMemberMeReq struct {
	DisplayName string `json:"display_name,optional"`
	Avatar      string `json:"avatar,optional"`
	Language    string `json:"language,optional"`
	Currency    string `json:"currency,optional"`
	Phone       string `json:"phone,optional"`
}

type UpdateMemberPlacementSettingsReq struct {
	WebSearchProvider *string `json:"web_search_provider,optional"`
	BraveAPIKey       *string `json:"brave_api_key,optional"`
	ExaAPIKey         *string `json:"exa_api_key,optional"`
	BraveCountry      *string `json:"brave_country,optional"`
	BraveSearchLang   *string `json:"brave_search_lang,optional"`
	ExaUserLocation   *string `json:"exa_user_location,optional"`
	ExpandStrategy    *string `json:"expand_strategy,optional"`
	DevModeEnabled    *bool   `json:"dev_mode_enabled,optional"`
}

type UpdateOutreachDraftHandlerReq struct {
	BrandPath
	DraftID string `path:"draftId" validate:"required"`
	UpdateOutreachDraftReq
}

type UpdateOutreachDraftReq struct {
	DraftIndex int    `json:"draft_index"`
	Text       string `json:"text" validate:"required"`
}

type UpdatePersonaHandlerReq struct {
	PersonaPath
	UpdatePersonaReq
}

type UpdatePersonaReq struct {
	DisplayName    *string `json:"display_name,optional"`
	Persona        *string `json:"persona,optional"`
	Brief          *string `json:"brief,optional"`
	StyleProfile   *string `json:"style_profile,optional"`
	StyleBenchmark *string `json:"style_benchmark,optional"`
}

type UpdatePlacementTopicHandlerReq struct {
	PlacementTopicPath
	UpdatePlacementTopicReq
}

type UpdatePlacementTopicOutreachDraftHandlerReq struct {
	PlacementTopicPath
	DraftID string `path:"draftId" validate:"required"`
	UpdateOutreachDraftReq
}

type UpdatePlacementTopicReq struct {
	BrandID         *string  `json:"brand_id,optional"`
	TopicName       *string  `json:"topic_name,optional"`
	SeedQuery       *string  `json:"seed_query,optional"`
	Brief           *string  `json:"brief,optional"`
	ProductID       *string  `json:"product_id,optional"`
	AudienceSummary *string  `json:"audience_summary,optional"`
	ContentGoal     *string  `json:"content_goal,optional"`
	Questions       []string `json:"questions,optional"`
	Pillars         []string `json:"pillars,optional"`
	Exclusions      []string `json:"exclusions,optional"`
	PatrolKeywords  []string `json:"patrol_keywords,optional"`
}

type UpdateThreadsAccountAiSettingsHandlerReq struct {
	ThreadsAccountPath
	UpdateThreadsAccountAiSettingsReq
}

type UpdateThreadsAccountAiSettingsReq struct {
	Provider         *string           `json:"provider,optional"`
	Model            *string           `json:"model,optional"`
	ResearchProvider *string           `json:"research_provider,optional"`
	ResearchModel    *string           `json:"research_model,optional"`
	ApiKeys          map[string]string `json:"api_keys,optional"`
}

type UpdateThreadsAccountConnectionHandlerReq struct {
	ThreadsAccountPath
	UpdateThreadsAccountConnectionReq
}

type UpdateThreadsAccountConnectionReq struct {
	SearchViaApi     *bool   `json:"search_via_api,optional"`
	SearchSourceMode *string `json:"search_source_mode,optional"`
	PublishViaApi    *bool   `json:"publish_via_api,optional"`
	DevMode          *bool   `json:"dev_mode,optional"`
	ScrapeReplies    *bool   `json:"scrape_replies,optional"`
	RepliesPerPost   *int    `json:"replies_per_post,optional"`
	PublishHeaded    *bool   `json:"publish_headed,optional"`
	PlaywrightDebug  *bool   `json:"playwright_debug,optional"`
}

type UpdateThreadsAccountHandlerReq struct {
	ThreadsAccountPath
	UpdateThreadsAccountReq
}

type UpdateThreadsAccountReq struct {
	DisplayName *string `json:"display_name,optional"`
	PersonaID   *string `json:"persona_id,optional"` // deprecated: use persona_id in publish payload instead
}

type UpsertBrandScanScheduleHandlerReq struct {
	BrandPath
	UpsertBrandScanScheduleReq
}

type UpsertBrandScanScheduleReq struct {
	Cron     string `json:"cron,optional"`
	Timezone string `json:"timezone,optional"`
	Enabled  bool   `json:"enabled"`
}

type UpsertCopyMissionScanScheduleHandlerReq struct {
	CopyMissionPath
	UpsertCopyMissionScanScheduleReq
}

type UpsertCopyMissionScanScheduleReq struct {
	Cron     string `json:"cron,optional"`
	Timezone string `json:"timezone,optional"`
	Enabled  bool   `json:"enabled"`
}

type UpsertJobTemplateReq struct {
	Type              string                `path:"type" validate:"required"`             // template type
	Version           int                   `json:"version,optional"`                     // template version
	Name              string                `json:"name" validate:"required"`             // display name
	Description       string                `json:"description,optional"`                 // description
	Enabled           bool                  `json:"enabled"`                              // enabled flag
	Repeatable        bool                  `json:"repeatable"`                           // repeatable flag
	ConcurrencyPolicy string                `json:"concurrency_policy,optional"`          // concurrency policy
	DedupeKeys        []string              `json:"dedupe_keys,optional"`                 // dedupe keys
	TimeoutSeconds    int                   `json:"timeout_seconds,optional"`             // timeout seconds
	CancelPolicy      JobCancelPolicyData   `json:"cancel_policy,optional"`               // cancel policy
	RetryPolicy       JobRetryPolicyData    `json:"retry_policy,optional"`                // retry policy
	Steps             []JobTemplateStepData `json:"steps" validate:"required,min=1,dive"` // steps
}

type UpsertPlacementTopicScanScheduleHandlerReq struct {
	PlacementTopicPath
	UpsertBrandScanScheduleReq
}

type UpsertPublishGuardPolicyHandlerReq struct {
	ThreadsAccountPath
	UpsertPublishGuardPolicyReq
}

type UpsertPublishGuardPolicyReq struct {
	Enabled                      bool   `json:"enabled"`
	MaxDailyPosts                int    `json:"max_daily_posts,optional"`
	MinIntervalMinutes           int    `json:"min_interval_minutes,optional"`
	ConsecutiveFailurePauseLimit int    `json:"consecutive_failure_pause_limit,optional"`
	Paused                       *bool  `json:"paused,optional"`
	PausedReason                 string `json:"paused_reason,optional"`
}

type UpsertPublishInventoryPolicyHandlerReq struct {
	ThreadsAccountPath
	UpsertPublishInventoryPolicyReq
}

type UpsertPublishInventoryPolicyReq struct {
	Enabled           bool                   `json:"enabled"`
	TargetDailyCount  int                    `json:"target_daily_count,optional"`
	LowStockThreshold int                    `json:"low_stock_threshold,optional"`
	LookaheadDays     int                    `json:"lookahead_days,optional"`
	Timezone          string                 `json:"timezone,optional"`
	Slots             []PublishSlotData      `json:"slots,optional"`
	SourceRefs        []PublishSourceRefData `json:"source_refs,optional"`
}

type UpsertStylePresetHandlerReq struct {
	StylePresetPath
	UpsertStylePresetReq
}

type UpsertStylePresetReq struct {
	Name        string   `json:"name" validate:"required"`
	Tone        string   `json:"tone,optional"`
	CTA         []string `json:"cta,optional"`
	BannedWords []string `json:"banned_words,optional"`
	Notes       string   `json:"notes,optional"`
	Apply       bool     `json:"apply,optional"`
}

type ViralScanPostData struct {
	ID              string          `json:"id"`
	SearchTag       string          `json:"search_tag"`
	Permalink       string          `json:"permalink"`
	Author          string          `json:"author"`
	AuthorVerified  bool            `json:"author_verified,omitempty"`
	FollowerCount   int             `json:"follower_count,omitempty"`
	Text            string          `json:"text"`
	LikeCount       int             `json:"like_count"`
	ReplyCount      int             `json:"reply_count"`
	EngagementScore int             `json:"engagement_score"`
	Source          string          `json:"source"`
	ScanJobID       string          `json:"scan_job_id"`
	Replies         []ScanReplyData `json:"replies,omitempty"`
	CreateAt        int64           `json:"create_at"`
}

type WorkerCancelCheckData struct {
	Cancelled bool `json:"cancelled"`
}

type WorkerCompleteReq struct {
	WorkerJobPath
	WorkerID string                 `json:"worker_id" validate:"required"`
	Result   map[string]interface{} `json:"result,optional"`
}

type WorkerFailReq struct {
	WorkerJobPath
	WorkerID string `json:"worker_id" validate:"required"`
	Error    string `json:"error" validate:"required"`
	Phase    string `json:"phase,optional"`
}

type WorkerHeartbeatReq struct {
	WorkerJobPath
	WorkerID   string `json:"worker_id" validate:"required"`
	TTLSeconds int    `json:"ttl_seconds,optional"`
}

type WorkerJobPath struct {
	ID string `path:"id" validate:"required"`
}

type WorkerJobReq struct {
	WorkerJobPath
	WorkerID string `json:"worker_id" validate:"required"`
}

type WorkerOKData struct {
	OK bool `json:"ok"`
}

type WorkerProgressReq struct {
	WorkerJobPath
	WorkerID   string                `json:"worker_id" validate:"required"`
	Phase      string                `json:"phase,optional"`
	Summary    string                `json:"summary,optional"`
	Percentage int                   `json:"percentage,optional"`
	Steps      []JobStepProgressData `json:"steps,optional"`
}

type WorkerThreadsAccountSessionData struct {
	AccountID    string `json:"account_id"`
	StorageState string `json:"storage_state"`
	UpdateAt     int64  `json:"update_at"`
}

type WorkerThreadsAccountSessionReq struct {
	ID       string `path:"id" validate:"required"`
	TenantID string `json:"tenant_id" validate:"required"`
	OwnerUID string `json:"owner_uid" validate:"required"`
}
