import { httpClient } from '../../../core/infrastructure/httpClient'; import type { StoryGroup } from '../../../core/domain/types'; export class StoryApi { static async getStories() { return httpClient.request('/stories'); } static async getUserStories(userId: string) { return httpClient.request(`/stories/user/${userId}`); } static async createStory(data: { type: string; mediaUrl?: string; content?: string; bgColor?: string }) { return httpClient.request<{ id: string }>('/stories', { method: 'POST', body: JSON.stringify(data), }); } static async uploadVideoToStory(file: File) { const formData = new FormData(); formData.append('file', file); return httpClient.request<{ url: string }>('/stories/video', { method: 'POST', body: formData, timeout: 120_000, }); } static async viewStory(storyId: string) { return httpClient.request<{ message: string }>(`/stories/${storyId}/view`, { method: 'POST' }); } static async deleteStory(storyId: string) { return httpClient.request<{ message: string }>(`/stories/${storyId}`, { method: 'DELETE' }); } static async getStoryViewers(storyId: string) { return httpClient.request>(`/stories/${storyId}/viewers`); } static async addStoryReaction(storyId: string, emoji: string) { return httpClient.request<{ message: string }>(`/stories/${storyId}/reaction`, { method: 'POST', body: JSON.stringify({ emoji }), }); } static async removeStoryReaction(storyId: string, emoji: string) { return httpClient.request<{ message: string }>(`/stories/${storyId}/reaction/delete?emoji=${encodeURIComponent(emoji)}`, { method: 'POST', }); } static async addStoryReply(storyId: string, content: string) { return httpClient.request<{ message: string }>(`/stories/${storyId}/reply`, { method: 'POST', body: JSON.stringify({ content }), }); } static async getStoryReplies(storyId: string) { return httpClient.request>(`/stories/${storyId}/replies`); } }