import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SmssendVO, SmssendForm, SmssendQuery } from '@/api/msg/smssend/types';

/**
 * 查询短信发送记录列表
 * @param query
 * @returns {*}
 */

export const listSmssend = (query?: SmssendQuery): AxiosPromise<SmssendVO[]> => {
  return request({
    url: '/msg/smssend/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询短信发送记录详细
 * @param sendId
 */
export const getSmssend = (sendId: string | number): AxiosPromise<SmssendVO> => {
  return request({
    url: '/msg/smssend/' + sendId,
    method: 'get'
  });
};

/**
 * 新增短信发送记录
 * @param data
 */
export const addSmssend = (data: SmssendForm) => {
  return request({
    url: '/msg/smssend',
    method: 'post',
    data: data
  });
};

/**
 * 修改短信发送记录
 * @param data
 */
export const updateSmssend = (data: SmssendForm) => {
  return request({
    url: '/msg/smssend',
    method: 'put',
    data: data
  });
};

/**
 * 删除短信发送记录
 * @param sendId
 */
export const delSmssend = (sendId: string | number | Array<string | number>) => {
  return request({
    url: '/msg/smssend/' + sendId,
    method: 'delete'
  });
};
