import { fetchRentalList, shelfRental, obtainedRental, addRental, getRental, updateRental } from '@/api/rental'

const transaction = {
  namespaced: true,
  state: {
  },

  mutations: {
  },

  actions: {
    // 获取收费组列表
    FetchRentalList({ commit }, listQuery) {
      return new Promise((resolve, reject) => {
        fetchRentalList(listQuery).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    AddRental({ commit }, listQuery) {
      return new Promise((resolve, reject) => {
        addRental(listQuery).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    UpdateRental({ commit }, listQuery) {
      return new Promise((resolve, reject) => {
        updateRental(listQuery).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    GetRental({ commit }, id) {
      return new Promise((resolve, reject) => {
        getRental(id).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    ShelfRental({ commit }, ids) {
      return new Promise((resolve, reject) => {
        shelfRental(ids).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    ObtainedRental({ commit }, ids) {
      return new Promise((resolve, reject) => {
        obtainedRental(ids).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}

export default transaction
