import { api, getCachedPatientId } from './request'; export interface MedicationReminder { id: string; patient_id: string; medication_name: string; dosage?: string; frequency?: string; reminder_times: string[]; start_date?: string; end_date?: string; is_active: boolean; notes?: string; version: number; created_at: string; updated_at: string; } export interface CreateReminderReq { patient_id: string; medication_name: string; dosage?: string; frequency?: string; reminder_times: string[]; start_date?: string; end_date?: string; is_active?: boolean; notes?: string; } export interface UpdateReminderReq { medication_name?: string; dosage?: string; frequency?: string; reminder_times?: string[]; start_date?: string; end_date?: string; is_active?: boolean; notes?: string; version: number; } function getPatientId(): string { return getCachedPatientId(); } export async function listReminders() { const patientId = getPatientId(); if (!patientId) return { data: [] as MedicationReminder[], total: 0 }; return api.get<{ data: MedicationReminder[]; total: number }>( `/health/patients/${patientId}/medication-reminders`, { page: 1, page_size: 100 }, 0, ); } export async function createReminder(req: CreateReminderReq) { return api.post('/health/medication-reminders', req); } export async function updateReminder(id: string, req: UpdateReminderReq) { return api.put(`/health/medication-reminders/${id}`, req); } export async function deleteReminder(id: string, version: number) { return api.delete(`/health/medication-reminders/${id}`, { version }); }