import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BaseAuditVO, BaseAuditForm, BaseAuditQuery, ProductAuditForm } from '@/api/product/baseAudit/types';

/**
 * 查询商品审核列表
 * @param query
 * @returns {*}
 */

export const listBaseAudit = (query?: BaseAuditQuery): AxiosPromise<BaseAuditVO[]> => {
  return request({
    url: '/product/baseAudit/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询商品审核详细
 * @param id
 */
export const getBaseAudit = (id: string | number): AxiosPromise<BaseAuditVO> => {
  return request({
    url: '/product/baseAudit/' + id,
    method: 'get'
  });
};

/**
 * 新增商品审核
 * @param data
 */
export const addBaseAudit = (data: BaseAuditForm) => {
  return request({
    url: '/product/baseAudit',
    method: 'post',
    data: data
  });
};

/**
 * 修改商品审核
 * @param data
 */
export const updateBaseAudit = (data: BaseAuditForm) => {
  return request({
    url: '/product/baseAudit',
    method: 'put',
    data: data
  });
};

/**
 * 删除商品审核
 * @param id
 */
export const delBaseAudit = (id: string | number | Array<string | number>) => {
  return request({
    url: '/product/baseAudit/' + id,
    method: 'delete'
  });
};

/**
 * 审核商品
 * @param data
 */
export const auditBaseAudit = (data: ProductAuditForm) => {
  return request({
    url: '/product/baseAudit/audit',
    method: 'post',
    data: data
  });
};

/**
 * 提交审核
 * @param data
 */
export const commitBaseAudit = (data: BaseAuditForm) => {
  return request({
    url: '/product/baseAudit/commit',
    method: 'post',
    data: data
  });
};
