import client from "./client";

export interface IntelItem {
  id: string;
  technique_id: string | null;
  url: string;
  title: string | null;
  source: string | null;
  detected_at: string | null;
  reviewed: boolean;
}

/** Fetch intel items, optionally filtered by technique UUID. */
export async function listIntelItems(
  techniqueId?: string,
  limit = 50,
): Promise<IntelItem[]> {
  const params: Record<string, string | number> = { limit };
  if (techniqueId) params.technique_id = techniqueId;
  const { data } = await client.get<IntelItem[]>("/intel/items", { params });
  return data;
}
