import { defHttp } from '/@/utils/http/axios';
import { setParams } from '/@/utils/index';
enum Api {
  sysNoticeAdd = '/sys/notice/add',
  sysNoticeDetail = '/sys/notice/detail',
  sysNoticeDetailUserNoticeId = '/sys/notice/detail/user',
  sysNoticeEdit = '/sys/notice/edit',
  sysNoticeExport = '/sys/notice/export',
  sysNoticeQueryList = '/sys/notice/query/list',
  sysNoticeQueryUser = '/sys/notice/query/user',
  sysNoticeRemove = '/sys/notice/remove',
  sysNoticeUserMarkRead = '/sys/notice/user/mark/read',
  sysNoticeUserMarkAllRead = '/sys/notice/user/mark/all/read',
  sysNoticeUserRemove = '/sys/notice/user/remove',
  sysNoticeUserMarkReadAll = '/sys/notice/user/mark/read/all',
  sysNoticeUserUnreadCount = '/sys/notice/user/unread/count',
}

/**
 * @description: 新增系统通知公告,权限 - sys:notice:add
 * @method: POST
 */
export const sysNoticeAdd = (params?: object) => {
  return defHttp.post({ url: Api.sysNoticeAdd, params: params });
};
/**
 * @description: 获取系统通知公告详细信息,权限 - sys:notice:query
 * @method: POST
 */
export const sysNoticeDetail = (noticeId: string) => {
  return defHttp.get({ url: Api.sysNoticeDetail + '/' + noticeId });
};
/**
 * @description: 用户获取系统通知公告详情
 * @method: GET
 */
export const sysNoticeDetailUserNoticeId = (noticeId?: string | number, params?: object) => {
  return defHttp.get({ url: Api.sysNoticeDetailUserNoticeId + '/' + noticeId, params: params });
};
/**
 * @description: 通过主键id修改系统通知公告,权限 - sys:notice:edit
 * @method: POST
 */
export const sysNoticeEdit = (params?: object) => {
  return defHttp.post({ url: Api.sysNoticeEdit, params: params });
};
/**
 * @description: 导出系统通知公告
 * @method: POST
 */
export const sysNoticeExport = (params?: object) => {
  return defHttp.post({ url: Api.sysNoticeExport, params: params });
};
/**
 * @description: 查询系统通知公告列表,权限 - sys:notice:list
 * @method: POST
 */

export const sysNoticeQueryList = (params?: object) => {
  return defHttp.post({ url: Api.sysNoticeQueryList, params: setParams(params) });
};
/**
 * @description: 用户查看系统通知公告列表
 * @method: POST
 */
export const sysNoticeQueryUser = (params?: object) => {
  return defHttp.post({ url: Api.sysNoticeQueryUser, params: params });
};
/**
 * @description: 删除系统通知公告,权限 - sys:notice:remove
 * @method: POST
 */

export const sysNoticeRemove = (params?: Array<string | number>) => {
  return defHttp.post({ url: Api.sysNoticeRemove, params: params });
};
/**
 * @description: 用户标记已读状态
 * @method: POST
 */
export const sysNoticeUserMarkRead = (params?: object) => {
  return defHttp.post({ url: Api.sysNoticeUserMarkRead, params: params });
};
/**
 * @description: 用户标记所有信息为已读
 * @method: POST
 */
export const sysNoticeUserMarkAllRead = (params?: object) => {
  return defHttp.post({ url: Api.sysNoticeUserMarkAllRead, params: params });
};
/**
 * @description: 用户删除系统公告
 * @method: POST
 */

export const sysNoticeUserRemove = (params?: Array<string | number>) => {
  return defHttp.post({ url: Api.sysNoticeUserRemove, params: params });
};
/**
 * @description: 用户标记所有信息为已读状态
 * @method: POST
 */
export const sysNoticeUserMarkReadAll = (params?: object) => {
  return defHttp.post({ url: Api.sysNoticeUserMarkReadAll, params: params });
};
/**
 * @description: 查询未读系统通知公告数量
 * @method: POST
 */
export const sysNoticeUserUnreadCount = (params?: object) => {
  return defHttp.post({ url: Api.sysNoticeUserUnreadCount, params: params });
};
