import http from '@/utils/http'
import { AppDispatch } from '..'
import { A7AddType } from '@/types/api/A7collection'

/**
 *公告管理-列表
 */

export const A7_APIgetList = (data: any): any => {
  return async (dispatch: AppDispatch) => {
    const res = await http.post('museum/artifact/page', data)
    if (res.code === 0) {
      const obj = {
        list: res.data.records,
        total: res.data.total
      }
      dispatch({ type: 'A7/getList', payload: obj })
    }
  }
}
/**
 * 藏品-删除
 */
export const A7_APIdel = (id: number) => {
  return http.post(`museum/artifact/del/${id}`)
}

/**
 * 藏品-获取详情
 */
export const A7_APIgetInfo = (id: number) => {
  return http.post(`museum/artifact/info/${id}`)
}

/**
 * 藏品 新增
 */
export const A7_APIadd = (data: A7AddType) => {
  return http.post('museum/artifact/add', data)
}

/**
 * 藏品 修改
 */
export const A7_APIedit = (data: A7AddType) => {
  return http.post('museum/artifact/edit', data)
}

/**
 * 藏品-发布
 */
export const A7_APIpublish = (id: number) => {
  return http.post(`museum/artifact/publish`, { artifactId: id })
}
