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

export interface MailAccountVO {
  id: number;
  mail: string;
  username: string;
  password: string;
  host: string;
  createTime: Date;
  port: number;
  sslEnable: boolean;
  starttlsEnable: boolean;
}

// 查询邮箱账号列表
// export const getMailAccountPage = async (params: PageParam) => {
//   return await request.get({ url: '/system/mail-account/page', params })
// }
export async function getMailAccountPage(params: PageParam) {
  return request("/system/mail-account/page", {
    method: "GET",
    params,
  });
}
// 查询邮箱账号详情
// export const getMailAccount = async (id: number) => {
//   return await request.get({ url: '/system/mail-account/get?id=' + id })
// }
export async function getMailAccount(id: number) {
  return request("/system/mail-account/get", {
    method: "GET",
    params: { id },
  });
}
// 新增邮箱账号
// export const createMailAccount = async (data: MailAccountVO) => {
//   return await request.post({ url: "/system/mail-account/create", data });
// };
export async function createMailAccount(data: MailAccountVO) {
  return request("/system/mail-account/create", {
    method: "POST",
    data,
  });
}
// 修改邮箱账号
// export const updateMailAccount = async (data: MailAccountVO) => {
//   return await request.put({ url: "/system/mail-account/update", data });
// };
export async function updateMailAccount(data: MailAccountVO) {
  return request("/system/mail-account/update", {
    method: "PUT",
    data,
  });
}
// 删除邮箱账号
// export const deleteMailAccount = async (id: number) => {
//   return await request.delete({ url: "/system/mail-account/delete?id=" + id });
// };
export async function deleteMailAccount(id: number) {
  return request("/system/mail-account/delete", {
    method: "DELETE",
    params: { id },
  });
}
// 获得邮箱账号精简列表
// export const getSimpleMailAccountList = async () => {
//   return request.get({ url: '/system/mail-account/simple-list' })
// }
export async function getSimpleMailAccountList() {
  return request("/system/mail-account/simple-list", {
    method: "GET",
  });
}
