/**
 * 全局配置 Schema（自 Web client settingsSchema 精简移植，供小程序设置页分 Tab 编辑）
 */

export type SettingFieldType = 'text' | 'textarea' | 'number' | 'menu-checkboxes' | 'email' | 'homepage-json'

export interface SettingSchemaItem {
  key: string
  label: string
  type: SettingFieldType
  group: 'site' | 'seo' | 'navigation' | 'homepage' | 'pagination' | 'contact'
  default: string
  description: string
}

export const SETTING_GROUPS: { id: SettingSchemaItem['group'], label: string }[] = [
  { id: 'site', label: '站点信息' },
  { id: 'seo', label: 'SEO' },
  { id: 'navigation', label: '导航菜单' },
  { id: 'homepage', label: '首页内容' },
  { id: 'pagination', label: '分页设置' },
  { id: 'contact', label: '联系方式' },
]

export const MENU_OPTIONS = [
  { key: 'home', label: '首页' },
  { key: 'blog', label: '思考' },
  { key: 'columns', label: '专栏' },
  { key: 'works', label: '作品' },
  { key: 'videos', label: '视频' },
  { key: 'snippets', label: '代码' },
  { key: 'about', label: '关于' },
  { key: 'services', label: '合作' },
]

export const SETTINGS_SCHEMA: SettingSchemaItem[] = [
  { key: 'site_title', label: '网站标题', type: 'text', group: 'site', default: '年糕崽崽.Dev', description: '站点名称' },
  { key: 'site_author', label: '网站作者', type: 'text', group: 'site', default: '', description: '作者名' },
  { key: 'site_description', label: '网站描述', type: 'textarea', group: 'seo', default: '', description: 'SEO 描述' },
  { key: 'site_keywords', label: '网站关键词', type: 'textarea', group: 'seo', default: '', description: '逗号分隔' },
  {
    key: 'visible_menus',
    label: '前台菜单',
    type: 'menu-checkboxes',
    group: 'navigation',
    default: '["home","blog","columns","works","videos","snippets","about","services"]',
    description: '控制前台导航显示',
  },
  {
    key: 'homepage_config',
    label: '首页配置 JSON',
    type: 'homepage-json',
    group: 'homepage',
    default: '{}',
    description: 'Hero / Bento 等首页结构，小程序端用 JSON 编辑',
  },
  { key: 'posts_per_page', label: '文章每页', type: 'number', group: 'pagination', default: '10', description: '' },
  { key: 'works_per_page', label: '作品每页', type: 'number', group: 'pagination', default: '12', description: '' },
  { key: 'snippets_per_page', label: '代码每页', type: 'number', group: 'pagination', default: '12', description: '' },
  { key: 'footer_icp', label: 'ICP 备案号', type: 'text', group: 'contact', default: '', description: '' },
  { key: 'contact_email', label: '联系邮箱', type: 'email', group: 'contact', default: '', description: '' },
]
