import request from '@/config/axios'

// 公司通知 VO
export interface NoticeVO {
  id: number // 主键
  title: string // 通知标题
  content: string // 通知内容
}

// 公司通知 API
export const NoticeApi = {
  // 查询公司通知分页
  getNoticePage: async (params: any) => {
    return await request.get({ url: `/company/notice/page`, params })
  },
  getNoticePageList: async (params: any) => {
    return await request.get({ url: `/company/notice/pageList`, params })
  },
  // 查询公司通知详情
  getNotice: async (id: number) => {
    return await request.get({ url: `/company/notice/get?id=` + id })
  },
  getNoticeDetail: async (id: number) => {
    return await request.get({ url: `/company/notice/get/detail?id=` + id })
  },
  // 新增公司通知
  createNotice: async (data: NoticeVO) => {
    return await request.post({ url: `/company/notice/create`, data })
  },

  // 修改公司通知
  updateNotice: async (data: NoticeVO) => {
    return await request.put({ url: `/company/notice/update`, data })
  },

  // 删除公司通知
  deleteNotice: async (id: number) => {
    return await request.delete({ url: `/company/notice/delete?id=` + id })
  },

  // 导出公司通知 Excel
  exportNotice: async (params) => {
    return await request.download({ url: `/company/notice/export-excel`, params })
  },

  // 批量删除公告
  deleteNoticeList: (ids: number[]) => {
    return request.delete({ url: '/system/notice/delete-list', params: { ids: ids.join(',') } })
  }
}
