import http from './http' export type HealthUser = { id: number phone: string displayName: string avatarUrl?: string } export type AuthOutput = { accessToken: string refreshToken: string user: HealthUser } export type HealthProfile = { birthday?: string gender?: string heightCm?: number weightKg?: number averageSleepHours?: number dailyExerciseMinutes?: number dietPreference?: string healthGoal?: string } export type PlanItem = { moduleCode: string title: string target: string advice: string } export type HealthPlan = { id: number version: number title: string summary: string createTime: string items: PlanItem[] } export type Dashboard = { user: HealthUser profile?: HealthProfile selectedModules: string[] currentPlan?: HealthPlan } export const healthApi = { register: (payload: { phone: string; password: string; displayName: string }) => http.post('/api/health/auth/register', payload), login: (payload: { phone: string; password: string }) => http.post('/api/health/auth/login', payload), dashboard: () => http.get('/api/health/dashboard'), saveProfile: (payload: HealthProfile) => http.put('/api/health/profile', payload), saveModules: (moduleCodes: string[]) => http.put('/api/health/modules', { moduleCodes }), generatePlan: () => http.post('/api/health/plans/generate') }