export function useChatService() {
  const { apiFetch } = useApi()

  return {
    sendMessage(formData: FormData) {
      return apiFetch('/chat/send-message', { method: 'POST', body: formData })
    },

    markAsSeen(readerId: number, otherId: number) {
      return apiFetch('/chat/seen', {
        method: 'POST',
        body: { reader_id: readerId, other_id: otherId },
      })
    },

    getChatUsers() {
      return apiFetch('/chat/users')
    },

    getMessages(userId: number, page = 1) {
      return apiFetch('/chat/messages', {
        query: { user_id: userId, page },
      })
    },
  }
}
