import { request } from '@/utils/http'
import type { ResultData } from '@/utils/http'

export type MenuItem = {
  id: number
  title: string
  cover: string
  children: MenuItem[]
  grid: number
  styleType: number
  otherType: number
  description: string
}
export type CategoryItem = {
  id: number
  title: string
  children: MenuItem[]
  parentId: number
  remark: string
}
export const getMenuList = (): Promise<ResultData<MenuItem[]>> => request.get('web/menu')
export const getCategoryTree = (id: number): Promise<ResultData<CategoryItem | CategoryItem[]>> =>
  request.get('web/category/tree', { id })
