import api, { ApiResponse } from './api'; export interface ContactMessage { id: string; name: string; email: string; phone: string | null; message: string; isRead: boolean; createdAt: string; } export interface ContactCounts { total: number; unread: number; } class ContactService { async getAllMessages(isRead?: boolean): Promise { const params: Record = {}; if (isRead !== undefined) params.isRead = String(isRead); const response = await api.get>('/contact/admin/all', { params }); return response.data.data; } async getCounts(): Promise { const response = await api.get>('/contact/admin/counts'); return response.data.data; } async markAsRead(id: string): Promise { const response = await api.patch>(`/contact/admin/${id}/read`); return response.data.data; } async deleteMessage(id: string): Promise { await api.delete(`/contact/admin/${id}`); } } export const contactService = new ContactService();