import { request } from '/@/utils/service';


const apiPrefix = '/api/cms/sku_kind/';

export function getTableData(query: any) {
  return request({
    url: apiPrefix,
    method: 'GET',
    params: query
  });
}

export function deleteRow(query: any) {
  return request({
    url: apiPrefix + query.id + '/',
    method: 'DELETE',
  });
}

export function updateRow(query: any) {
  return request({
    url: apiPrefix + query.id + '/',
    method: 'PUT',
    data: query
  });
}

export function create(data:any) {
  return request({
    url: apiPrefix,
    method: 'post',
    data: data
  })
}


export function getAttributeManageData(query: any) {
  return request({
    url: '/api/cms/sku_kind_attr/',
    method: 'GET',
    params: query
  });
}

export function getAttributeOptions(query: any) {
  return request({
    url: '/api/cms/sku_attr/',
    method: 'GET',
    params: query
  });
}

export function updateAttributeRow(query: any) {
  return request({
    url: '/api/cms/sku_kind_attr/' + query.id + '/',
    method: 'PUT',
    data: query
  });
}

export function createProductAttr(body: any) {
  return request({
    url: 'api/cms/sku_kind_attr/',
    method: 'POST',
    data: body
  });
}

export function deleteProductAttr(id: any) {
  return request({
    url: `api/cms/sku_kind_attr/${id}/`,
    method: 'DELETE',
  });
}

export function release(query: any) {
  return request({
    url: `/api/cms/sku_kind/${query.id}/?partial=${query.partial}`,
    method: 'PUT',
    data: { status: query.status }
  });
}

export function updateOrder(query: any) {
  return request({
    url: `/api/cms/sku_kind_attr/${query.id}/`,
    method: 'PUT',
    data: query
  });
}
