import type { Post } from "../types/post";

const SAMPLE_VIDEO_URL =
  "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4";
const SAMPLE_VIDEO_POSTER =
  "data:image/svg+xml;utf8," +
  encodeURIComponent(
    `<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 360'>
      <defs>
        <linearGradient id='g' x1='0' x2='1' y1='0' y2='1'>
          <stop offset='0' stop-color='%23eeb726'/>
          <stop offset='1' stop-color='%231f1f24'/>
        </linearGradient>
      </defs>
      <rect width='640' height='360' fill='url(%23g)'/>
      <text x='50%' y='52%' font-family='sans-serif' font-size='44' font-weight='700' fill='%23111' text-anchor='middle'>ARK · 视频示例</text>
    </svg>`,
  );

function img(seed: number, w = 800, h = 600): string {
  return `https://picsum.photos/seed/ark-${seed}/${w}/${h}`;
}

function thumb(seed: number): string {
  return `https://picsum.photos/seed/ark-${seed}/200/200`;
}

export const MOCK_POSTS: Post[] = [
  // 1) 图片当文档（image as document）— jpg
  {
    id: "p-001",
    categoryId: 1,
    categorySlug: "project",
    language: "zh-CN",
    attachments: [
      {
        id: "a-001",
        kind: "document",
        mime: "image/jpeg",
        url: img(11, 1200, 1600),
        thumbnailUrl: thumb(11),
        filename: "ARK项目一图读懂-01.jpg",
        sizeBytes: 3_549_239,
        width: 1200,
        height: 1600,
      },
    ],
    isRecommended: false,
    publishedAt: "2026-02-27T17:58:00.000Z",
    updatedAt: "2026-02-27T17:58:00.000Z",
  },

  // 2) 图片当文档 — png
  {
    id: "p-002",
    categoryId: 1,
    categorySlug: "project",
    language: "zh-CN",
    attachments: [
      {
        id: "a-002",
        kind: "document",
        mime: "image/png",
        url: img(12, 1080, 1080),
        thumbnailUrl: thumb(12),
        filename: "ARK主网核心合约地址-BSC链.png",
        sizeBytes: 2_134_000,
        width: 1080,
        height: 1080,
      },
    ],
    isRecommended: false,
    publishedAt: "2026-02-28T11:30:00.000Z",
    updatedAt: "2026-02-28T11:30:00.000Z",
  },

  // 3) PPT 文档（项目资料分类，验证首页「项目资料(PPT)」预选 PPT）
  {
    id: "p-013",
    categoryId: 1,
    categorySlug: "project",
    language: "zh-CN",
    attachments: [
      {
        id: "a-013",
        kind: "document",
        mime: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
        url: "https://example.com/files/ARK-project-deck.pptx",
        filename: "ARK 项目资料介绍.pptx",
        sizeBytes: 5_432_100,
      },
    ],
    isRecommended: true,
    publishedAt: "2026-03-01T10:00:00.000Z",
    updatedAt: "2026-03-01T10:00:00.000Z",
  },

  // 4) PDF 文档
  {
    id: "p-003",
    categoryId: 2,
    categorySlug: "guide",
    language: "zh-CN",
    attachments: [
      {
        id: "a-003",
        kind: "document",
        mime: "application/pdf",
        url: "https://example.com/files/ARKIE-AI-fold.pdf",
        filename: "ARKIE AI-三折页.pdf",
        sizeBytes: 2_097_152,
      },
    ],
    isRecommended: true,
    publishedAt: "2026-05-16T11:14:00.000Z",
    updatedAt: "2026-05-16T11:14:00.000Z",
  },

  // 4) AI 文件
  {
    id: "p-004",
    categoryId: 2,
    categorySlug: "guide",
    language: "zh-CN",
    attachments: [
      {
        id: "a-004",
        kind: "document",
        mime: "application/postscript",
        url: "https://example.com/files/ARKIE-AI-fold-source.ai",
        filename: "ARKIE AI-三折页 - 转曲.ai",
        sizeBytes: 32_087_654,
      },
    ],
    isRecommended: false,
    publishedAt: "2026-05-16T11:14:30.000Z",
    updatedAt: "2026-05-16T11:14:30.000Z",
  },

  // 5) 纯文本 + 链接（市场数据平台）
  {
    id: "p-005",
    categoryId: 3,
    categorySlug: "data",
    language: "zh-CN",
    text:
      "📊 ARK DeFAI 各大平台现已上线 🔥\n\n" +
      "🔷 市场数据平台\n" +
      "✅ CoinMarketCap (CMC) https://coinmarketcap.com/currencies/ark-defai/\n" +
      "✅ CoinGecko https://www.coingecko.com/en/coins/ark-3\n\n" +
      "🔷 链上数据与图表工具\n" +
      "✅ Dexscreener (BSC) https://dexscreener.com/bsc/0xcaaf3c41a40103a23eeaa4bba468af3cf5b0e0d8\n" +
      "✅ DexTools https://www.dextools.io/app/en/token/arkdefai\n" +
      "✅ AVE https://ave.ai/token/0xcae117ca6bc8a341d2e7207f30e180f0e1n",
    attachments: [],
    isRecommended: false,
    publishedAt: "2026-01-19T16:20:00.000Z",
    updatedAt: "2026-01-19T16:20:00.000Z",
    // Mock: only the FIRST URL in the text is previewed.
    linkPreview: {
      url: "https://coinmarketcap.com/currencies/ark-defai/",
      canonicalUrl: "https://coinmarketcap.com/currencies/ark-defai/",
      siteName: "coinmarketcap.com",
      title: "ARK DeFAI Price, Chart & Market Cap",
      description:
        "Track ARK DeFAI live price, market cap, volume and historical chart on CoinMarketCap. Verified contract address, holders and on-chain analytics.",
      imageUrl: img(81, 1200, 630),
      imageWidth: 1200,
      imageHeight: 630,
      themeColor: "#2962FF",
    },
  },

  // 6) 纯文本 + 单链接（简短公告）
  {
    id: "p-006",
    categoryId: 3,
    categorySlug: "data",
    language: "zh-CN",
    text:
      "📌 收取协议固定 2.5% 手续费。\n\n" +
      "🔷 贡献值合约\n0x7736b5B84cADDB7661D250D10e60E31F3C905c99\n📌 用于新贡献值机制的 USDT 购买与资金流向管理（通缩销毁 / 储备 RBS）",
    attachments: [],
    isRecommended: false,
    publishedAt: "2026-05-16T01:50:00.000Z",
    updatedAt: "2026-05-16T01:50:00.000Z",
  },

  // 7) 视频（带海报 + 时长 + 说明文字）
  {
    id: "p-007",
    categoryId: 4,
    categorySlug: "videos",
    language: "zh-CN",
    text: "ARK 山东·东营社区 招商复盘·势位重塑\n🔥 ARK DeFai 相位偏移锁死增值弧度。质能裂变诱发认知风暴，海岱动能正于中原合围！🚀",
    attachments: [
      {
        id: "a-007",
        kind: "video",
        mime: "video/mp4",
        url: SAMPLE_VIDEO_URL,
        posterUrl: SAMPLE_VIDEO_POSTER,
        filename: "ARK-中国-山东-东营-2月27日.mp4",
        sizeBytes: 2_726_297,
        width: 1280,
        height: 720,
        durationSec: 29,
      },
    ],
    isRecommended: true,
    publishedAt: "2026-02-27T15:19:00.000Z",
    updatedAt: "2026-02-27T15:19:00.000Z",
  },

  // 8) 单张图片（横图）
  {
    id: "p-008",
    categoryId: 5,
    categorySlug: "poster",
    language: "zh-CN",
    attachments: [
      {
        id: "a-008",
        kind: "image",
        mime: "image/jpeg",
        url: img(21, 1600, 900),
        thumbnailUrl: thumb(21),
        filename: "ark-banner-horizontal.jpg",
        sizeBytes: 1_280_000,
        width: 1600,
        height: 900,
      },
    ],
    isRecommended: false,
    publishedAt: "2026-05-22T22:37:00.000Z",
    updatedAt: "2026-05-22T22:37:00.000Z",
  },

  // 9) 单张图片（竖图，每日海报）
  {
    id: "p-009",
    categoryId: 5,
    categorySlug: "poster",
    language: "zh-CN",
    attachments: [
      {
        id: "a-009",
        kind: "image",
        mime: "image/jpeg",
        url: img(22, 720, 1280),
        thumbnailUrl: thumb(22),
        filename: "good-morning-poster.jpg",
        sizeBytes: 980_000,
        width: 720,
        height: 1280,
      },
    ],
    isRecommended: false,
    publishedAt: "2026-05-22T22:42:00.000Z",
    updatedAt: "2026-05-22T22:42:00.000Z",
  },

  // 10) 图片 + 文字（含链接）
  {
    id: "p-010",
    categoryId: 6,
    categorySlug: "meeting",
    language: "zh-CN",
    text: "📌 ARK DeFAI 方舟晨间时刻\n\n🧠 会议主题：市场概况交流 & 市场问题讨论。\n🕙 会议时间：3月1日（日）10:00\n🎬 直播腾讯会议链接：https://meeting.tencent.com/l/G718S4Sedm38",
    linkPreview: {
      url: "https://meeting.tencent.com/l/G718S4Sedm38",
      canonicalUrl: "https://meeting.tencent.com/l/G718S4Sedm38",
      siteName: "meeting.tencent.com",
      title: "腾讯会议 · ARK DeFAI 方舟晨间时刻",
      description:
        "点击直接加入直播会议。需要 App 或浏览器插件。会议号会在点击后自动补全。",
      themeColor: "#0080FF",
    },
    attachments: [
      {
        id: "a-010",
        kind: "image",
        mime: "image/jpeg",
        url: img(31, 1200, 1800),
        thumbnailUrl: thumb(31),
        filename: "ark-defai-morning-poster.jpg",
        sizeBytes: 2_345_678,
        width: 1200,
        height: 1800,
      },
    ],
    isRecommended: true,
    publishedAt: "2026-05-22T16:42:00.000Z",
    updatedAt: "2026-05-22T16:42:00.000Z",
  },

  // 11) 3 图相册
  {
    id: "p-011",
    categoryId: 5,
    categorySlug: "poster",
    language: "zh-CN",
    attachments: [
      {
        id: "a-011a",
        kind: "image",
        mime: "image/jpeg",
        url: img(41, 1080, 1080),
        thumbnailUrl: thumb(41),
        filename: "album-1.jpg",
        sizeBytes: 850_000,
        width: 1080,
        height: 1080,
      },
      {
        id: "a-011b",
        kind: "image",
        mime: "image/jpeg",
        url: img(42, 1080, 1080),
        thumbnailUrl: thumb(42),
        filename: "album-2.jpg",
        sizeBytes: 720_000,
        width: 1080,
        height: 1080,
      },
      {
        id: "a-011c",
        kind: "image",
        mime: "image/jpeg",
        url: img(43, 1080, 1080),
        thumbnailUrl: thumb(43),
        filename: "album-3.jpg",
        sizeBytes: 690_000,
        width: 1080,
        height: 1080,
      },
    ],
    isRecommended: false,
    publishedAt: "2026-05-23T10:15:00.000Z",
    updatedAt: "2026-05-23T10:15:00.000Z",
  },

  // 12) 7 图相册（触发 +N 模糊）
  {
    id: "p-012",
    categoryId: 5,
    categorySlug: "poster",
    language: "zh-CN",
    attachments: Array.from({ length: 7 }).map((_, i) => ({
      id: `a-012-${i}`,
      kind: "image" as const,
      mime: "image/jpeg",
      url: img(50 + i, 1080, 1080),
      thumbnailUrl: thumb(50 + i),
      filename: `gallery-${i + 1}.jpg`,
      sizeBytes: 700_000 + i * 10_000,
      width: 1080,
      height: 1080,
    })),
    isRecommended: false,
    publishedAt: "2026-05-24T14:42:00.000Z",
    updatedAt: "2026-05-24T14:42:00.000Z",
  },
];
