import baseAxios from './index'

export interface treeNode {
  info: {
    id: number,
    parent_id: number,
    name: string,
    icon: string,
    path: string,
    position: number,
    document_num: number,
    create_time: number,
    create_by: number,
    update_by: number
  },
  children: Array<treeNode>
}

export async function queryDocTree() {
  return baseAxios<{ children: Array<treeNode> }>({
    url: '/document/category/tree',
    method: 'GET',
  })
}

export interface info {
  id: number,
  category_id: number,
  title: string,
  introduction: string,
  content: string,
  position: number,
  create_time: number,
  update_time: number,
  create_by: number,
  update_by: number
}
export interface article {
  total?: number,
  list: info[]
}

export async function queryDocList(data: {
  category_id: number,
  page: number,
  page_size: number
}) {
  return baseAxios<article>({
    url: '/document/list',
    method: 'GET',
    params: data
  })
}


