import { http } from './client'; import type { Company, CompanyMember, Profile } from '../types'; interface Notification { id: string; type: string; title: string; content: string; is_read: boolean; created_at: string; } interface CompanyRelationship { id: string; company: Company; role: string; } export const commonApi = { getCompany: (id: string) => http.get(`/common/companies/${id}`).then(r => r.data), listRelationships: () => http.get('/common/companies').then(r => r.data), listMembers: () => http.get<(CompanyMember & { profile: Profile })[]>('/common/members').then(r => r.data), createMember: (data: { username: string; password: string; display_name: string; phone?: string }) => http.post('/common/members', data).then(r => r.data), deleteMember: (id: string) => http.delete(`/common/members/${id}`), listNotifications: () => http.get('/common/notifications').then(r => r.data), markNotificationRead: (id: string) => http.patch(`/common/notifications/${id}`, { is_read: true }), createShareLink: (data: { resource_type: string; resource_id: string }) => http.post<{ code: string }>('/common/share-links', data).then(r => r.data), getShareLink: (code: string) => http.get(`/common/share-links/${code}`).then(r => r.data), submitFeedback: (data: { content: string }) => http.post('/common/feedback', data), };