import { createListPageTests } from '../../test/factories/listPageTests';
import DialysisManageList from './DialysisManageList';

// DialysisManageList 需要先选择患者才会加载表格数据
// 使用 route 带 patient_id 参数模拟已有患者选择的场景
const mockDialysis = Array.from({ length: 6 }, (_, i) => ({
  id: `dialysis-${i + 1}`,
  patient_id: `patient-1`,
  patient_name: `患者1`,
  dialysis_date: '2026-05-10',
  status: (['scheduled', 'in_progress', 'completed'] as const)[i % 3],
  dialysis_type: 'hemodialysis',
  created_at: '2026-04-01T10:00:00Z',
  updated_at: '2026-04-01T10:00:00Z',
  version: 1,
}));

createListPageTests({
  Component: DialysisManageList,
  apiPath: '/api/v1/health/dialysis-records',
  columns: ['透析日期', '状态'],
  firstRowTexts: ['患者1'],
  totalItems: 6,
  hasCreateButton: true,
  createButtonText: '添加记录',
  hasSearch: true,
  hasPagination: false,
  route: '/?patient_id=patient-1',
  mockItems: mockDialysis as Record<string, unknown>[],
});
