import request from '@/utils/request'
import type { ShopGoodsEvaluate, SubmitEvaluateParams, EvaluatePageParams } from './model'

/** 提交商品评价 */
export function submitGoodsEvaluate(data: SubmitEvaluateParams) {
  return request.post<ShopGoodsEvaluate>('/shopGoodsEvaluate/submit', data)
}

/** 获取商品评价列表 */
export function pageGoodsEvaluate(params: EvaluatePageParams = {}) {
  return request.post<{ items: ShopGoodsEvaluate[]; total: number }>('/shopGoodsEvaluate/page', params)
}

/** 获取我的评价列表 */
export function myGoodsEvaluate(params: { page?: number; pageSize?: number } = {}) {
  return request.post<{ items: ShopGoodsEvaluate[]; total: number }>('/shopGoodsEvaluate/myList', params)
}

/** 获取评价详情 */
export function getGoodsEvaluate(id: number) {
  return request.post<ShopGoodsEvaluate>('/shopGoodsEvaluate/get', { id })
}
