export type TransactionType = 'income' | 'expense' export type AssetBalanceType = 'cumulative' | 'monthly_reset' export interface Asset { id: string name: string balanceType: AssetBalanceType initialBalance: number active: boolean sortOrder: number balance?: number } export interface Category { id: string type: TransactionType name: string icon: string color: string parentId: string | null sortOrder: number active: boolean parent?: Category | null children?: Category[] } export interface Transaction { id: string type: TransactionType occurredAt: string assetId: string categoryId: string amount: number title: string memo: string | null latitude: string | null longitude: string | null asset: Asset category: Category & { parent?: Category | null } } export function useMoneyApi() { const refresh = () => refreshNuxtData() return { refresh, assets: () => useFetch('/api/assets'), categories: () => useFetch('/api/categories'), transactions: (month: Ref) => useFetch<{ summary: { income: number; expense: number; diff: number }; transactions: Transaction[] }>('/api/transactions', { query: { month } }) } }