import { listAnnouncement, addAnnouncement, announcementById, updateannouncement, deleteAnnouncement } from '@/api/announcement'

const announcement = {
  actions: {
    /**
     *获取当前小区的所有公告
     */
    ListAnnouncement({ commit }, data) {
      return new Promise((resolve, reject) => {
        listAnnouncement(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    /**
     * 添加公告
     */
    AddAnnouncement({ commit }, data) {
      return new Promise((resolve, reject) => {
        addAnnouncement(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    /**
     * 根据id查询公告
     */
    AnnouncementById({ commit }, data) {
      return new Promise((resolve, reject) => {
        announcementById(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    /**
     * 根据id查询公告
     */
    Updateannouncement({ commit }, data) {
      return new Promise((resolve, reject) => {
        updateannouncement(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    /**
     * 批量删除
     */
    DeleteAnnouncement({ commit }, data) {
      return new Promise((resolve, reject) => {
        deleteAnnouncement(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}
export default announcement
