import { invoke } from "@tauri-apps/api/core"; export type FeedbackErrorCode = | "invalid" | "rate_limit" | "server_error" | "network_error"; export interface FeedbackContext { page?: string; locale?: string; theme?: string; viewport?: string; userAgent?: string; timestamp?: string; } export interface FeedbackSuccess { id: string; created_at: string; } export interface SendFeedbackInput { content: string; userId?: string | null; context?: FeedbackContext; } export async function sendFeedback( input: SendFeedbackInput, ): Promise { return invoke("send_feedback", { content: input.content, userId: input.userId ?? null, context: input.context ?? null, }); } export async function getFeedbackUserAgent(): Promise { return invoke("get_feedback_user_agent"); } export function isFeedbackErrorCode(value: unknown): value is FeedbackErrorCode { return ( value === "invalid" || value === "rate_limit" || value === "server_error" || value === "network_error" ); }