import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TemplateSettingVO, TemplateSettingForm, TemplateSettingQuery } from '@/api/setting/templateSetting/types';

/**
 * 查询短信模板配置列表
 * @param query
 * @returns {*}
 */

export const listTemplateSetting = (query?: TemplateSettingQuery): AxiosPromise<TemplateSettingVO[]> => {
  return request({
    url: '/system/templateSetting/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询短信模板配置详细
 * @param id
 */
export const getTemplateSetting = (id: string | number): AxiosPromise<TemplateSettingVO> => {
  return request({
    url: '/system/templateSetting/' + id,
    method: 'get'
  });
};

/**
 * 新增短信模板配置
 * @param data
 */
export const addTemplateSetting = (data: TemplateSettingForm) => {
  return request({
    url: '/system/templateSetting',
    method: 'post',
    data: data
  });
};

/**
 * 修改短信模板配置
 * @param data
 */
export const updateTemplateSetting = (data: TemplateSettingForm) => {
  return request({
    url: '/system/templateSetting',
    method: 'put',
    data: data
  });
};

/**
 * 删除短信模板配置
 * @param id
 */
export const delTemplateSetting = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/templateSetting/' + id,
    method: 'delete'
  });
};
