// TODO: replace with API
export const uploadRecordMock = [
  { name: '季度风险监测报告.docx', time: '2026-04-11 09:20' },
  { name: '海外舆情摘编-第12期.pdf', time: '2026-04-10 16:43' },
  { name: '政策快报-智能风控.txt', time: '2026-04-09 11:08' }
]

/** 文档上传记录列表（含表格字段） */
export const uploadRecordListMock = [
  {
    id: 'r-1',
    name: '季度风险监测报告.pdf',
    uploadTime: '2026-04-11 09:20',
    sizeBytes: 2457600,
    status: '已完成'
  },
  {
    id: 'r-2',
    name: '海外舆情摘编-第12期.pdf',
    uploadTime: '2026-04-10 16:43',
    sizeBytes: 892416,
    status: '翻译中'
  },
  {
    id: 'r-3',
    name: '政策快报-智能风控.pdf',
    uploadTime: '2026-04-09 11:08',
    sizeBytes: 524288,
    status: '已完成'
  },
  {
    id: 'r-4',
    name: '合规审查备忘录.pdf',
    uploadTime: '2026-04-08 14:22',
    sizeBytes: 1310720,
    status: '失败'
  }
]

// TODO: replace with API
export const articleTreeMock = [
  {
    id: 'sec-1',
    title: '一、风险概览',
    children: [
      { id: 'sec-1-p1', title: '1.1 全球流动性', sectionId: 'sec-1' },
      { id: 'sec-1-p2', title: '1.2 跨境资本流动', sectionId: 'sec-1' }
    ]
  },
  {
    id: 'sec-2',
    title: '二、重点行业观察',
    children: [{ id: 'sec-2-p1', title: '2.1 科技供应链', sectionId: 'sec-2' }]
  },
  {
    id: 'sec-3',
    title: '三、处置建议',
    children: [{ id: 'sec-3-p1', title: '3.1 预警与演练', sectionId: 'sec-3' }]
  }
]

// TODO: replace with API
export const paragraphRowsMock = [
  {
    id: 'p-1',
    sectionId: 'sec-1',
    sourceText:
      'Global liquidity tightened in Q1, increasing refinancing pressure in emerging markets.',
    translatedText: '第一季度全球流动性收紧，增加了新兴市场的再融资压力。'
  },
  {
    id: 'p-2',
    sectionId: 'sec-1',
    sourceText: 'Cross-border capital flow volatility remained high across major regions.',
    translatedText: '主要地区跨境资本流动波动仍处于高位。'
  },
  {
    id: 'p-3',
    sectionId: 'sec-2',
    sourceText:
      'Technology supply chains showed mixed recovery signals with persistent inventory risk.',
    translatedText: '科技供应链出现分化修复信号，但库存风险仍然存在。'
  },
  {
    id: 'p-4',
    sectionId: 'sec-3',
    sourceText:
      'It is recommended to improve early-warning thresholds and optimize contingency drills.',
    translatedText: '建议完善预警阈值设置并优化应急演练机制。'
  }
]

/**
 * 文档对照页显示用的版式识别结果示例 JSON。
 * 后续可按 1 PDF -> 1 JSON 的接口返回直接映射。
 */
export const layoutStyleResultMock = {
  schema_version: '3.0',
  document_meta: {
    source_file_name: '测试文档.pdf',
    source_file_type: 'pdf',
    page_count: 3,
    created_at: '2026-04-08T15:00:00Z'
  },
  pages: [
    {
      page_idx: 0,
      width: 594.96,
      height: 841.92,
      rotation: null,
      node_ids: ['page0_node0', 'page0_node1', 'page0_node2', 'page0_node3', 'page0_node4']
    }
  ],
  merged_nodes: [
    {
      node_id: 'page0_node0',
      semantic_type: 'page_header',
      page_idx: 0,
      content_payload: {
        type: 'text',
        text: '格式转换测试文件',
        html: '<b><span style="color:#333333">格式转换测试文件</span></b>',
        heading_level: null,
        content_fragments: [{ type: 'text', content: '格式转换测试文件' }],
        markdown: null
      },
      layout: {
        bbox: [67, 78, 395, 111],
        bbox_norm: [0.069, 0.079, 0.397, 0.112],
        angle: 0,
        reading_order: 0,
        page_idx: 0,
        link: null,
        z_index: null
      },
      style_spans: [
        {
          span_id: 'page0_node0_s0',
          start: 0,
          end: 8,
          text: '格式转换测试文件',
          style: {
            bold: true,
            italic: false,
            underline: false,
            superscript: false,
            subscript: false,
            color_hex: '#333333'
          }
        }
      ]
    }
  ]
}

/** 文档对照数据（TODO: 替换为真实接口） */
export function fetchDocumentCompareMock(_fileName, delayMs = 2500) {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve({
        articleTree: articleTreeMock,
        paragraphRows: paragraphRowsMock,
        translationProgress: 12,
        layoutStyleResult: layoutStyleResultMock
      })
    }, delayMs)
  })
}
