import type { categoryTopItem } from '@/types/category'
import type { PageParams, PageResult } from '@/types/global'
import type { goodsListItem } from '@/types/goods'
import { request } from '@/utils/request'

export const getCategoryApi = () => {
  return request<categoryTopItem[]>({
    method: 'GET',
    url: 'shop/goods/classify',
  })
}

export const getTopCategoryApi = () => {
  return request<categoryTopItem[]>({
    method: 'GET',
    url: 'shop/goods/topClassify',
  })
}

export const getClassifyDetailApi = (
  data: PageParams & {
    classify_id: string
  },
) => {
  return request<PageResult<goodsListItem[]>>({
    method: 'GET',
    url: 'shop/goods/classifyDetail',
    data,
  })
}

export const getAllClassifyADatapi = () => {
  return request<categoryTopItem[]>({
    method: 'GET',
    url: 'shop/goods/allClassify',
  })
}
