import { apiGet, apiPost } from "./client";

export interface PromptFile {
	name: string;
	title: string;
	description?: string;
	argumentHint?: string;
}

export function fetchPrompts(): Promise<{ prompts: PromptFile[] }> {
	return apiGet("/api/prompts");
}

export function fetchPromptFile(name: string): Promise<{ content: string }> {
	return apiGet(`/api/prompts/file?name=${encodeURIComponent(name)}`);
}

export function savePromptFile(name: string, content: string): Promise<{ ok?: boolean }> {
	return apiPost("/api/prompts/file", { name, content });
}

export function deletePromptFile(name: string): Promise<{ ok?: boolean }> {
	return apiPost("/api/prompts/delete", { name });
}
