"use client"
import { Suspense } from "react"
import { getPageTrade } from "@/actions/trade"
import { DataTable, useDataTable } from "@/components/data-table"
import type { User } from "@/models/user"

export default function UserPage() {
  const table = useDataTable<User>((page, size) => getPageTrade({ page, size }))
  console.log(table, "table")

  return (
    <Suspense>
      <DataTable<User>
        {...table}
        columns={[
          { header: "ID", accessorKey: "id" },
          { header: "套餐号", accessorKey: "inner_no" },
          { header: "支付方式", accessorKey: "method" },
          { header: "支付金额", accessorKey: "payment" },
          { header: "支付平台", accessorKey: "platform" },
          { header: "已退款", accessorKey: "refunded" },
          { header: "支付状态", accessorKey: "status" },
          { header: "购买套餐", accessorKey: "subject" },
          { header: "类型", accessorKey: "type" },
          { header: "创建时间", accessorKey: "created_at" },
          { header: "更新时间", accessorKey: "updated_at" },
          { header: "过期时间", accessorKey: "canceled_at" },
        ]}
      />
    </Suspense>
  )
}
