import apiClient from "./api/client" /** Who can see this FAQ entry in product surfaces */ export type FaqAudience = "END_USER" | "SYSTEM_USER" | "ALL" export interface FaqEntry { id: string question: string answer: string audience: FaqAudience sortOrder: number isPublished: boolean createdAt: string updatedAt?: string } export interface PaginatedFaqs { data: FaqEntry[] total: number page: number limit: number totalPages: number } class FaqService { async list(params?: { page?: number limit?: number audience?: FaqAudience search?: string }): Promise { const response = await apiClient.get("/faq", { params, }) return response.data } async create(data: { question: string answer: string audience: FaqAudience sortOrder?: number isPublished?: boolean }): Promise { const response = await apiClient.post("/faq", data) return response.data } async update( id: string, data: Partial< Pick< FaqEntry, "question" | "answer" | "audience" | "sortOrder" | "isPublished" > >, ): Promise { const response = await apiClient.patch(`/faq/${id}`, data) return response.data } async remove(id: string): Promise { await apiClient.delete(`/faq/${id}`) } } export const faqService = new FaqService()