// Halo API 路径常量
// 便于统一管理和 Halo API 升级时批量修改

export const ApiPaths = {
  // 文章相关 (UC API)
  posts: {
    list: (page: number, size: number, labelSelector?: string) =>
      `/apis/uc.api.content.halo.run/v1alpha1/posts?page=${page}&size=${size}${labelSelector ? `&labelSelector=${encodeURIComponent(labelSelector)}` : ""}`,
    get: (name: string) =>
      `/apis/uc.api.content.halo.run/v1alpha1/posts/${name}`,
    getDraft: (name: string) =>
      `/apis/uc.api.content.halo.run/v1alpha1/posts/${name}/draft?patched=true`,
    create: () =>
      `/apis/uc.api.content.halo.run/v1alpha1/posts`,
    update: (name: string) =>
      `/apis/uc.api.content.halo.run/v1alpha1/posts/${name}`,
    delete: (name: string) =>
      `/apis/uc.api.content.halo.run/v1alpha1/posts/${name}`,
    publish: (name: string) =>
      `/apis/uc.api.content.halo.run/v1alpha1/posts/${name}/publish`,
    unpublish: (name: string) =>
      `/apis/uc.api.content.halo.run/v1alpha1/posts/${name}/unpublish`,
  },

  // 分类相关 (Content API)
  categories: {
    list: () =>
      `/apis/content.halo.run/v1alpha1/categories`,
    get: (name: string) =>
      `/apis/content.halo.run/v1alpha1/categories/${name}`,
    create: () =>
      `/apis/content.halo.run/v1alpha1/categories`,
    update: (name: string) =>
      `/apis/content.halo.run/v1alpha1/categories/${name}`,
    delete: (name: string) =>
      `/apis/content.halo.run/v1alpha1/categories/${name}`,
  },

  // 标签相关 (Content API)
  tags: {
    list: () =>
      `/apis/content.halo.run/v1alpha1/tags`,
    get: (name: string) =>
      `/apis/content.halo.run/v1alpha1/tags/${name}`,
    create: () =>
      `/apis/content.halo.run/v1alpha1/tags`,
    update: (name: string) =>
      `/apis/content.halo.run/v1alpha1/tags/${name}`,
    delete: (name: string) =>
      `/apis/content.halo.run/v1alpha1/tags/${name}`,
  },

  // 附件/图片上传 (Console API)
  attachments: {
    upload: () =>
      `/apis/api.console.halo.run/v1alpha1/attachments/upload`,
  },

  // 用户权限 (Console API)
  users: {
    permissions: () =>
      `/apis/api.console.halo.run/v1alpha1/users/-/permissions`,
  },
} as const;

export type ApiPaths = typeof ApiPaths;