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

export interface NoticeVO {
  id: number;
  title: string;
  type: number;
  content: string;
  status: number;
  remark: string;
  creator: string;
  createTime: Date;
}

// 查询公告列表
// export const getNoticePage = (params: PageParam) => {
//   return request.get({ url: '/system/notice/page', params })
// }
export async function getNoticePage(params: PageParam) {
  return request("/system/notice/page", {
    method: "GET",
    params,
  });
}
// 查询公告详情
// export const getNotice = (id: number) => {
//   return request.get({ url: '/system/notice/get?id=' + id })
// }
export async function getNotice(id: number) {
  return request("/system/notice/get", {
    method: "GET",
    params: { id },
  });
}
// 新增公告
// export const createNotice = (data: NoticeVO) => {
//   return request.post({ url: '/system/notice/create', data })
// }
export async function createNotice(data: NoticeVO) {
  return request("/system/notice/create", {
    method: "POST",
    data,
  });
}
// 修改公告
// export const updateNotice = (data: NoticeVO) => {
//   return request.put({ url: '/system/notice/update', data })
// }
export async function updateNotice(data: NoticeVO) {
  return request("/system/notice/update", {
    method: "PUT",
    data,
  });
}
// 删除公告
// export const deleteNotice = (id: number) => {
//   return request.delete({ url: '/system/notice/delete?id=' + id })
// }
export async function deleteNotice(id: number) {
  return request("/system/notice/update", {
    method: "DELETE",
    params: { id },
  });
}
// 推送公告
// export const pushNotice = (id: number) => {
//   return request.post({ url: '/system/notice/push?id=' + id })
// }

export async function pushNotice(id: number) {
  return request("/system/notice/push", {
    method: "POST",
    params: { id },
  });
}
