import { request } from '/@/utils/service'
import { UserPageQuery, AddReq, DelReq, EditReq, InfoReq } from '@fast-crud/fast-crud'


export const apiPrefix = '/api/sellers/home/daily/'
export function getCardData(query: UserPageQuery) {

  return request({
    url: '/api/sellers/home/total/',
    method: 'GET',
    params: query,
  })
}
export function getLineData(query: UserPageQuery) {
  query['dateRangeType'] = 'D'
  return request({
    url: apiPrefix,
    method: 'GET',
    params: query,
  })
}

export function getLineWeekData(query: UserPageQuery) {
  query['dateRangeType'] = 'W'
  return request({
    url: apiPrefix,
    method: 'GET',
    params: query,
  })
}

export function getLineMonthData(query: UserPageQuery) {
  query['dateRangeType'] = 'M'
  return request({
    url: apiPrefix,
    method: 'GET',
    params: query,
  })
}

export function getProductLineSelect(query) {
  return request({
    url: '/api/sellers/productline/',
    method: 'GET',
    params: query,
  })
}
export function getAllProduct(query) {
  return request({
    url: '/api/sellers/goods/all/',
    method: 'GET',
    params: query,
  })
}
export function postCreateProductLine(body) {
  return request({
    url: '/api/sellers/productline/create/',
    method: 'POST',
    data: body,
  })
}
export function getProductCardData(query) {
  return request({
    url: '/api/sellers/productline/sales/',
    method: 'GET',
    params: query,
  })
}
export function getProductDetail(query) {
  return request({
    url: '/api/sellers/productlinedetail/',
    method: 'GET',
    params: query,
  })
}
export function postUpdateProductLine(body) {
  return request({
    url: '/api/sellers/productlinedetail/update/',
    method: 'POST',
    data: body,
  })
}
export function getTableDataForSKU(query) {
  return request({
    url: '/api/sellers/home/sku/list/',
    method: 'GET',
    params: query,
  })
}
export function getTableDataForProductLine(query) {
  return request({
    url: '/api/sellers/home/productline/list/',
    method: 'GET',
    params: query,
  })
}
export function getTableDataForParentASIN(query) {
  return request({
    url: '/api/sellers/home/pasin/list/',
    method: 'GET',
    params: query,
  })
}
export function getTableDataForASIN(query) {
  return request({
    url: '/api/sellers/home/asin/list/',
    method: 'GET',
    params: query,
  })
}
export function postDeleteProductLine(body) {
  return request({
    url: '/api/sellers/productline/delete/',
    method: 'POST',
    data: body,
  })
}