import { serviceCaseCover, addCaseCover, getCaseListData, deleteServiceBatch, addCase, getCaseTypeListData } from '@/api/case'

const servicecase = {
  namespaced: true,

  actions: {
    getCaseCover({ commit, state }, data) {
      return new Promise((resolve, reject) => {
        serviceCaseCover(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    createCaseCover({ commit, state }, data) {
      return new Promise((resolve, reject) => {
        addCaseCover(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    createCase({ commit, state }, data) {
      return new Promise((resolve, reject) => {
        addCase(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    getCaseList({ commit, state }, data) {
      return new Promise((resolve, reject) => {
        getCaseListData(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    getCaseTypeList({ commit, state }, data) {
      return new Promise((resolve, reject) => {
        getCaseTypeListData(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    deleteService({ commit, state }, data) { // 删除 活动报名人员
      return new Promise((resolve, reject) => {
        deleteServiceBatch(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}

export default servicecase
