import { fetchWithAuth } from "./client";

export const onboardingApi = {
  /** 检查引导状态 */
  checkOnboardingStatus: (token: string) =>
    fetchWithAuth("/api/v1/onboarding/status", {}, token),

  /** 创建引导品牌 */
  createOnboardingBrand: (
    token: string,
    data: {
      name: string;
      competitors: string[];
      platforms: string[];
      frequency: "daily" | "weekly" | "monthly";
    }
  ) =>
    fetchWithAuth(
      "/api/v1/onboarding/brand",
      { method: "POST", body: JSON.stringify(data) },
      token
    ),

  /** 获取竞品推荐 */
  getCompetitorRecommendations: (token: string, brandName: string) =>
    fetchWithAuth(
      `/api/v1/onboarding/competitor-recommendations?brand_name=${encodeURIComponent(brandName)}`,
      {},
      token
    ),

  /** 获取健康报告 */
  getHealthReport: (token: string, brandId: string) =>
    fetchWithAuth(`/api/v1/onboarding/health-report/${brandId}`, {}, token),

  /** 获取行动建议 */
  getActionSuggestions: (token: string, brandId: string) =>
    fetchWithAuth(`/api/v1/onboarding/action-suggestions/${brandId}`, {}, token),

  /** 完成引导 */
  completeOnboarding: (token: string, brandId: string) =>
    fetchWithAuth(
      `/api/v1/onboarding/complete/${brandId}`,
      { method: "POST" },
      token
    ),
};
