import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SendRecordVO, SendRecordForm, SendRecordQuery } from '@/api/customer/sendRecord/types';

/**
 * 查询寄样记录列表
 * @param query
 * @returns {*}
 */

export const listSendRecord = (query?: SendRecordQuery): AxiosPromise<{records:SendRecordVO[]}> => {
  return request({
    url: '/send-record/list',
    method: 'post',
    data: query
  });
};

/**
 * 查询寄样记录详细
 * @param id
 */
export const getSendRecord = (id: string | number): AxiosPromise<SendRecordVO> => {
  return request({
    url: '/send-record/get-by-id?id=' + id,
    method: 'get'
  });
};

/**
 * 新增/修改寄样记录
 * @param data
 */
export const addSendRecord = (data: SendRecordForm) => {
  return request({
    url: '/send-record/add',
    method: 'post',
    data: data
  });
};

/**
 * 删除寄样记录
 * @param id
 */
export const delSendRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/send-record/delete',
    method: 'post',
    data: {id}
  });
};
