import { useMocks } from "../index";

const mocks = useMocks();

// 总收益 Mock 数据
mocks.register("income/total", () => {
  return {
    // 总收益概览
    overview: {
      totalRevenue: 125680.50, // 累计总收益
      yesterdayRevenue: 1256.80, // 昨日收益
      monthRevenue: 38450.20, // 本月收益
      pendingRevenue: 5420.30, // 待确认收益
      currency: "USD",
    },
    // 收益趋势数据（最近7天）
    trend: [
      { date: "2025-12-21", revenue: 1100.50 },
      { date: "2025-12-22", revenue: 1300.80 },
      { date: "2025-12-23", revenue: 1450.20 },
      { date: "2025-12-24", revenue: 1200.60 },
      { date: "2025-12-25", revenue: 1350.90 },
      { date: "2025-12-26", revenue: 1380.40 },
      { date: "2025-12-27", revenue: 1256.80 },
    ],
    // 收益来源分布
    sources: [
      {
        type: "dividend", // 分红收益
        name: "分红收益",
        amount: 85420.30,
        percentage: 67.96,
        count: 125,
      },
      {
        type: "appreciation", // 资产增值
        name: "资产增值",
        amount: 32150.20,
        percentage: 25.59,
        count: 45,
      },
      {
        type: "trade", // 交易收益
        name: "交易收益",
        amount: 8110.00,
        percentage: 6.45,
        count: 89,
      },
    ],
    // 最近收益明细
    recentRecords: [
      {
        id: "1",
        type: "dividend",
        typeName: "分红收益",
        assetName: "纽约曼哈顿中心公寓",
        assetCode: "NYC-001",
        amount: 520.50,
        currency: "USD",
        date: "2025-12-27 10:30:00",
        status: "completed", // completed, pending, processing
      },
      {
        id: "2",
        type: "appreciation",
        typeName: "资产增值",
        assetName: "旧金山商业地产",
        assetCode: "SF-002",
        amount: 320.80,
        currency: "USD",
        date: "2025-12-27 09:15:00",
        status: "completed",
      },
      {
        id: "3",
        type: "trade",
        typeName: "交易收益",
        assetName: "洛杉矶住宅楼",
        assetCode: "LA-003",
        amount: 215.50,
        currency: "USD",
        date: "2025-12-26 16:45:00",
        status: "completed",
      },
      {
        id: "4",
        type: "dividend",
        typeName: "分红收益",
        assetName: "迈阿密海景别墅",
        assetCode: "MIA-004",
        amount: 680.20,
        currency: "USD",
        date: "2025-12-26 14:20:00",
        status: "pending",
      },
      {
        id: "5",
        type: "appreciation",
        typeName: "资产增值",
        assetName: "芝加哥写字楼",
        assetCode: "CHI-005",
        amount: 450.60,
        currency: "USD",
        date: "2025-12-25 11:30:00",
        status: "completed",
      },
    ],
  };
});

// 收益明细列表（支持筛选）
mocks.register("income/records", () => {
  return {
    list: Array.from({ length: 20 }, (_, index) => ({
      id: String(index + 1),
      type: ["dividend", "appreciation", "trade"][index % 3],
      typeName: ["分红收益", "资产增值", "交易收益"][index % 3],
      assetName: `资产名称 ${index + 1}`,
      assetCode: `ASSET-${String(index + 1).padStart(3, "0")}`,
      amount: (Math.random() * 1000 + 100).toFixed(2),
      currency: "USD",
      date: new Date(Date.now() - index * 86400000).toISOString(),
      status: ["completed", "pending", "processing"][index % 3],
    })),
    total: 100,
    page: 1,
    pageSize: 20,
  };
});
