import { _list, _view, _export, _add, _adds, _up, _ups, _del } from '@/api/app'
import { reformateObjectRes } from '@/utils/index'

const useAImodeltcManageStore = defineStore('AImodeltcManage', {
  state: () => ({
    //...
  }),
  actions: {
    //* *********** 模型套餐 **************
    // 获取列表
    list(data) {
      return new Promise((resolve, reject) => {
        data.pagevalue = 109
        _list(data)
          .then((res) => {
            resolve(res.Data)
          })
          .catch((err) => {
            reject(err)
          })
      })
    },
    // 获取详情
    view(data) {
      return new Promise((resolve, reject) => {
        data.pagevalue = 110
        _view(data)
          .then((res) => {
            resolve(reformateObjectRes(res.Data))
          })
          .catch((err) => {
            reject(err)
          })
      })
    },
    // 更新
    up(data) {
      return new Promise((resolve, reject) => {
        data.pagevalue = 111
        _up(data)
          .then((res) => {
            resolve(res.Data)
          })
          .catch((err) => {
            reject(err)
          })
      })
    },
    // 新增
    add(data) {
      return new Promise((resolve, reject) => {
        data.pagevalue = 112
        _add(data)
          .then((res) => {
            resolve(res.Data)
          })
          .catch((err) => {
            reject(err)
          })
      })
    },
  },
})

export default useAImodeltcManageStore
