import { fetchWithAuth } from "./client";

export const strategyApi = {
  generatePlan: (token: string, brandId: string, targetScore?: number) =>
    fetchWithAuth("/api/v1/strategy/generate", {
      method: "POST",
      body: JSON.stringify({ brand_id: brandId, target_score: targetScore ?? 75 }),
    }, token),

  getBrandPlans: (token: string, brandId: string) =>
    fetchWithAuth(`/api/v1/strategy/brand/${brandId}`, {}, token),

  getPlanDetail: (token: string, planId: string) =>
    fetchWithAuth(`/api/v1/strategy/${planId}`, {}, token),

  updateActionStatus: (token: string, actionId: string, status: string) =>
    fetchWithAuth(`/api/v1/strategy/actions/${actionId}/status`, {
      method: "PUT",
      body: JSON.stringify({ status }),
    }, token),

  executeAction: (token: string, actionId: string) =>
    fetchWithAuth(`/api/v1/strategy/actions/${actionId}/execute`, {
      method: "POST",
    }, token),
};
