import { defineCollection, defineCollections } from 'vuepress-theme-plume'

/** 博客目录名 → 中文分类展示 */
const BLOG_CATEGORY_LABEL_ZH: Record<string, string> = {
  blog: '博客',
  competition: '竞赛',
  technology: '技术',
  website: '网站',
  elysia: '爱莉希雅',
  collect: '合集',
}

export default defineCollections([
  defineCollection({
    type: 'post',
    dir: 'blog',
    title: '博客',
    link: '/blog/',
    linkPrefix: '/article/',
    postCover: {
      layout: 'left',
      compact: true,
    },
    categoriesTransform: (categories) =>
      categories.map((c) => ({
        ...c,
        name: BLOG_CATEGORY_LABEL_ZH[c.name] ?? c.name,
      })),
  }),

  defineCollection({
    type: 'doc',
    dir: 'notes/programming/leetcode',
    title: 'LeetCode',
    linkPrefix: '/programming/leetcode/',
    sidebar: [
      { text: 'LeetCode 指南', link: '/programming/leetcode/' },
      {
        text: '刷题题单',
        prefix: '/question_sheet',
        items: [
          { text: 'LeetCode 入门题单～(≧∇≦)ﾉ', link: '/programming/leetcode/question_sheet/beginner/' },
        ],
      },
    ],
  }),

  defineCollection({
    type: 'doc',
    dir: 'notes/subject/english',
    title: '英语学习',
    linkPrefix: '/subject/english/',
    sidebar: [
      { text: '英语学习笔记', link: '/subject/english/' },
      {
        text: '学习环境与工具',
        prefix: '/basis',
        items: [{ text: '英语环境配置', link: '/subject/english/basis/' }],
      },
      {
        text: '词汇与记忆',
        prefix: '/vocabulary',
        items: [{ text: '词汇学习与记忆法', link: '/subject/english/vocabulary/' }],
      },
      {
        text: '语法与句法',
        prefix: '/grammar',
        items: [{ text: '核心语法与句型', link: '/subject/english/grammar/' }],
      },
      {
        text: '听力与口语',
        prefix: '/listening-speaking',
        items: [{ text: '听力口语训练', link: '/subject/english/listening-speaking/' }],
      },
      {
        text: '阅读与写作',
        prefix: '/reading-writing',
        items: [{ text: '阅读提升', link: '/subject/english/reading-writing/' }],
      },
      {
        text: '写译',
        prefix: '/writing-translation',
        items: [{ text: '写作与翻译指南', link: '/subject/english/writing-translation/' }],
      },
      {
        text: '考试与备考',
        prefix: '/exam',
        items: [{ text: '英语四级 (CET-4) 备考指南', link: '/subject/english/exam/cet-4/' }],
      },
      {
        text: '资源与工具',
        prefix: '/resources',
        items: [{ text: '学习资源与工具', link: '/subject/english/resources/' }],
      },
    ],
  }),

  defineCollection({
    type: 'doc',
    dir: 'notes/subject/certification',
    title: '系统分析师',
    linkPrefix: '/subject/certification/',
    sidebar: [
      { text: '系统分析师简介', link: '/subject/certification/' },
      {
        text: '第一篇 基础知识',
        prefix: '/certification/sys-analyst',
        items: [
          { text: '第一章 绪论', link: '/subject/certification/sys-analyst/' },
          { text: '第二章 数学与工程基础', link: '/subject/certification/sys-analyst/math/' },
        ],
      },
      {
        text: '第二篇 关键技术',
        prefix: '/certification/sys-analyst',
        items: [
          { text: '第十章 系统规划与分析', link: '/subject/certification/sys-analyst/planning/' },
        ],
      },
    ],
  }),

  defineCollection({
    type: 'doc',
    dir: 'notes/programming/solidity',
    title: 'Solidity',
    linkPrefix: '/programming/solidity/',
    sidebar: [
      { text: 'Solidity 学习笔记', link: '/programming/solidity/' },
      {
        text: '基础语法',
        prefix: '/basic-syntax',
        items: [
          { text: 'Solidity 基础语法与数据类型', link: '/programming/solidity/basic-syntax/' },
        ],
      },
      {
        text: '项目实例',
        prefix: '/basic-syntax',
        items: [{ text: 'Solidity 代码实例', link: '/programming/solidity/analysis/case-analysis/' }],
      },
      {
        text: '杂项',
        prefix: '/other',
        items: [
          { text: 'Hardhat 相关知识', link: '/programming/solidity/other/hardhat/' },
          { text: '一些没分类的小知识', link: '/programming/solidity/other/miscellaneous/' },
        ],
      },
    ],
  }),

  defineCollection({
    type: 'doc',
    dir: 'notes/theory/cryptography',
    title: '密码学基础',
    linkPrefix: '/theory/cryptography/',
    sidebar: [
      { text: '密码学基础', link: '/theory/cryptography/' },
      {
        text: '古典加密算法',
        prefix: '/theory',
        items: [
          { text: '替换密码', link: '/theory/cryptography/substitution-ciphers/' },
          { text: '置换密码', link: '/theory/cryptography/permutation-encryption/' },
        ],
      },
    ],
  }),

  defineCollection({
    type: 'doc',
    dir: 'notes/ops/blockchain',
    title: '区块链运维',
    linkPrefix: '/ops/blockchain/',
    sidebar: [
      { text: '区块链运维指南', link: '/ops/blockchain/' },
      {
        text: '区块链理论基础',
        prefix: '/theory',
        items: [
          { text: '区块链的基本原理', link: '/ops/blockchain/theory/basic-principles/' },
          { text: 'FISCO-BCOS 节点类型', link: '/ops/blockchain/theory/fisco-bcos-node-type/' },
        ],
      },
      {
        text: '区块链运维',
        items: [
          { text: '区块链产品设计和基本部署', link: '/ops/blockchain/practice/basic-deployment/' },
          { text: '区块链网络部署与管理', link: '/ops/blockchain/practice/node-deployment/' },
          { text: 'Console 控制台操作', link: '/ops/blockchain/practice/console-operator/' },
        ],
      },
    ],
  }),

  defineCollection({
    type: 'doc',
    dir: 'notes/ops/linux',
    title: 'Linux 运维',
    linkPrefix: '/ops/linux/',
    sidebar: [
      { text: 'Linux 运维笔记', link: '/ops/linux/' },
      {
        text: 'Linux 基础',
        prefix: '/linux',
        items: [{ text: 'Linux 基础命令详解', link: '/ops/linux/basic-commands/' }],
      },
      {
        text: '其他',
        prefix: '/linux',
        items: [{ text: '一些零散的命令', link: '/ops/linux/other/' }],
      },
    ],
  }),

  defineCollection({
    type: 'doc',
    dir: 'notes/ops/docker',
    title: 'Docker',
    linkPrefix: '/ops/docker/',
    sidebar: [
      { text: 'Docker 运维笔记', link: '/ops/docker/' },
      {
        text: '数据库相关',
        prefix: '/ops/docker/db/',
        items: [
          { text: 'MongoDB 部署', link: '/ops/docker/db/mongodb/' },
          { text: 'Postgres 部署', link: '/ops/docker/db/postgres/' },
        ],
      },
      {
        text: '其他服务',
        prefix: '/ops/docker/other/',
        items: [{ text: 'ETLCloud 部署', link: '/ops/docker/other/ETLCloud/' }],
      },
    ],
  }),

  defineCollection({
    type: 'doc',
    dir: 'notes/programming/web',
    title: 'Web 开发',
    linkPrefix: '/programming/web/',
    sidebar: [
      { text: 'Web 开发学习笔记', link: '/programming/web/' },
      {
        text: '基础知识',
        prefix: '/basic-syntax',
        items: [
          { text: 'Web 前端基础讲解', link: '/programming/web/basic-syntax/html-css-js/' },
          { text: 'HTML 常用标签与属性', link: '/programming/web/basic-syntax/html-tags-attributes/' },
          { text: 'HTML 列表与语义布局', link: '/programming/web/basic-syntax/html-lists-and-semantic-layout/' },
          { text: 'JavaScript 基础知识', link: '/programming/web/basic-syntax/javascript-basics/' },
        ],
      },
    ],
  }),
])
