import { listTicket, ticketEdit, addRecordComment, addRecord, updateTicketStatus, updateTicket, imgAdd } from '@/api/ticket'

const ticket = {
  actions: {
    /**
     *获取当前小区的所有工单信息
     */
    ListTicket({ commit }, data) {
      return new Promise((resolve, reject) => {
        listTicket(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    TicketEdit({ commit }, data) {
      return new Promise((resolve, reject) => {
        ticketEdit(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    AddRecordComment({ commit }, data) {
      return new Promise((resolve, reject) => {
        addRecordComment(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    AddRecord({ commit }, data) {
      return new Promise((resolve, reject) => {
        addRecord(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    UpdateTicketStatus({ commit }, data) {
      return new Promise((resolve, reject) => {
        updateTicketStatus(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    UpdateTicket({ commit }, data) {
      return new Promise((resolve, reject) => {
        updateTicket(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    ImgAdd({ commit }, data) {
      return new Promise((resolve, reject) => {
        imgAdd(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}
export default ticket
