/**
 * 下一步行动相关类型定义
 */

import type {
  ActionPriority as ActionPriorityBase,
  ActionItem,
} from "./suggestion";

// 从统一类型重新导出
export type ActionPriority = ActionPriorityBase;
export type { ActionItem };

// 行动项（扩展自统一 ActionItem，保留 actionText 和 actionUrl 兼容字段）
export interface NextAction extends ActionItem {
  actionText: string; // 行动按钮文字
  actionUrl: string; // 兼容旧字段，与 href 值相同
}

// 用户状态上下文
export interface ActionContext {
  // 用户数据状态
  hasData: boolean;
  hasBrands: boolean;
  brandCount: number;
  overallScore: number;
  scoreChange: number;
  competitorCount: number;
  hasQueryHistory: boolean;

  // 当前页面上下文
  currentPage: "dashboard" | "brand" | "compare";
  brandId?: string;
}

// 行动建议生成参数
export interface ActionGenerationParams {
  context: ActionContext;
  cachedActions?: NextAction[];
}

// 行动建议规则（action 定义中不需要 href，由 createAction 自动从 actionUrl 生成）
type ActionDefinition = Omit<NextAction, "id" | "priority" | "href">;
export interface ActionRule {
  condition: (context: ActionContext) => boolean;
  primaryAction: ActionDefinition;
  secondaryAction: ActionDefinition | null;
  optionalAction: ActionDefinition | null;
}

// 行动建议卡片Props
export interface NextActionCardProps {
  context: ActionContext;
  className?: string;
  onActionClick?: (action: NextAction) => void;
}

// 行动建议项渲染Props
export interface ActionItemProps {
  action: NextAction;
  onClick?: () => void;
}
