import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MsgSignSettingVO, MsgSignSettingForm, MsgSignSettingQuery } from '@/api/setting/msgSignSetting/types';

/**
 * 查询短信签名管理列表
 * @param query
 * @returns {*}
 */

export const listMsgSignSetting = (query?: MsgSignSettingQuery): AxiosPromise<MsgSignSettingVO[]> => {
  return request({
    url: '/system/msgSignSetting/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询短信签名管理详细
 * @param id
 */
export const getMsgSignSetting = (id: string | number): AxiosPromise<MsgSignSettingVO> => {
  return request({
    url: '/system/msgSignSetting/' + id,
    method: 'get'
  });
};

/**
 * 新增短信签名管理
 * @param data
 */
export const addMsgSignSetting = (data: MsgSignSettingForm) => {
  return request({
    url: '/system/msgSignSetting',
    method: 'post',
    data: data
  });
};

/**
 * 修改短信签名管理
 * @param data
 */
export const updateMsgSignSetting = (data: MsgSignSettingForm) => {
  return request({
    url: '/system/msgSignSetting',
    method: 'put',
    data: data
  });
};

/**
 * 删除短信签名管理
 * @param id
 */
export const delMsgSignSetting = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/msgSignSetting/' + id,
    method: 'delete'
  });
};

/**
 * 状态修改
 * @param id 短信签名ID
 * @param status 状态
 */
export const changeStatus = (id: number | string, status: string) => {
  const data = {
    id,
    status
  };
  return request({
    url: '/system/msgSignSetting/changeStatus',
    method: 'put',
    data: data
  });
};
