import { api } from '@/lib/api' export interface WidgetLayoutItem { i: string widgetType: string x: number y: number w: number h: number } export interface DashboardPreferencesResponse { userId: string | null role: string isDefault: boolean layout: WidgetLayoutItem[] } export const dashboard = { getPreferences: () => api.get('/dashboard/preferences').then(r => r.data), savePreferences: (layout: WidgetLayoutItem[]) => api.put('/dashboard/preferences', { layout }).then(r => r.data), getDefaults: (role: string) => api.get(`/dashboard/defaults/${role}`).then(r => r.data), saveDefaults: (role: string, layout: WidgetLayoutItem[]) => api.put(`/dashboard/defaults/${role}`, { layout }).then(r => r.data), }