import { AccountQuery, LeaveListVO, LeaveQuery, paramsaccountOV, seachookOV } from '@/api/set/messagetype';

import { AxiosPromise } from 'axios';
import request from '@/utils/request';

export const listlist = (query?: LeaveQuery): AxiosPromise => {
  return request({
    url: '/system/message/page',
    method: 'get',
    params: query
  });
};
//删除模板
export const deltemplate = (query?: string): AxiosPromise => {
  return request({
    url: `/im/message/template/${query}`,
    method: 'delete'
  });
};
//查看详情模板
export const getnotice = (query?: string): AxiosPromise => {
  return request({
    url: `/im/message/template/${query}`,
    method: 'get'
  });
};
/**
 * 模板修改
 * @param data
 */
export const updateCategory = (data: seachookOV) => {
  return request({
    url: '/im/message/template/list',
    method: 'post',
    data: data
  });
};
//获取下拉列表
export const listuserlist = (query?: string | number): AxiosPromise => {
  return request({
    url: `/system/message/user/list?keyword=${query}`,
    method: 'get'
    // params: query
  });
};

//发送消息
export const listAdd = (query?: LeaveListVO): AxiosPromise => {
  return request({
    url: '/system/message/send',
    method: 'post',
    data: query
  });
};
//获取模板列表
export const listtemplate = (query?: AccountQuery): AxiosPromise => {
  return request({
    url: '/im/message/template/page',
    method: 'post',
    data: query
  });
};
//添加模板
export const templateAdd = (query?: paramsaccountOV): AxiosPromise => {
  return request({
    url: '/im/message/template/add',
    method: 'post',
    data: query
  });
};
//下拉搜索获取模板
export const templateSelect = (query?: string): AxiosPromise => {
  return request({
    url: `/system/message/template/listByName?name=${query}`,
    method: 'get'
  });
};
