import { request } from "@umijs/max";

export interface SmsChannelVO {
  id: number;
  code: string;
  status: number;
  signature: string;
  remark: string;
  apiKey: string;
  apiSecret: string;
  callbackUrl: string;
  createTime: Date;
}

// 查询短信渠道列表
// export const getSmsChannelPage = (params: PageParam) => {
//   return request.get({ url: '/system/sms-channel/page', params })
// }
export async function getSmsChannelPage(params: PageParam) {
  return request("/system/sms-channel/page", {
    method: "GET",
    params,
  });
}
// 获得短信渠道精简列表
// export function getSimpleSmsChannelList() {
//   return request.get({ url: '/system/sms-channel/simple-list' })
// }
export async function getSimpleSmsChannelList() {
  return request("/system/sms-channel/simple-list", {
    method: "GET",
  });
}
// 查询短信渠道详情
// export const getSmsChannel = (id: number) => {
//   return request.get({ url: '/system/sms-channel/get?id=' + id })
// }
export async function getSmsChannel(id: number) {
  return request("/system/sms-channel/get", {
    method: "GET",
    params: { id },
  });
}
// 新增短信渠道
// export const createSmsChannel = (data: SmsChannelVO) => {
//   return request.post({ url: '/system/sms-channel/create', data })
// }
export async function createSmsChannel(data: SmsChannelVO) {
  return request("/system/sms-channel/create", {
    method: "POST",
    data,
  });
}
// 修改短信渠道
// export const updateSmsChannel = (data: SmsChannelVO) => {
//   return request.put({ url: '/system/sms-channel/update', data })
// }
export async function updateSmsChannel(data: SmsChannelVO) {
  return request("/system/sms-channel/update", {
    method: "PUT",
    data,
  });
}
// 删除短信渠道
// export const deleteSmsChannel = (id: number) => {
//   return request.delete({ url: '/system/sms-channel/delete?id=' + id })
// }
export async function deleteSmsChannel(id: number) {
  return request("/system/sms-channel/delete", {
    method: "DELETE",
    params: { id },
  });
}
