import type { favoriteItem } from '@/types/favorite'
import type { PageParams, PageResult } from '@/types/global'
import { request } from '@/utils/request'

export const getFavoriteListApi = (data: PageParams) => {
  return request<PageResult<favoriteItem[]>>({
    url: 'shop/userFavorite/list',
    method: 'GET',
    data,
  })
}

export const postAddFavoriteApi = (data: { goods_id: number }) => {
  return request({
    url: 'shop/userFavorite/add',
    method: 'POST',
    data,
  })
}

export const postCancelFavoriteApi = (data: { goods_id: string | number; is_all?: boolean }) => {
  return request({
    url: 'shop/userFavorite/delete',
    method: 'POST',
    data,
  })
}
