import { request } from '/@/utils/service'
import { AddReq, DelReq, EditReq, UserPageQuery } from '@fast-crud/fast-crud'

export const apiPrefix = '/api/ad_manage/spplacement/'
export function GetList(query: UserPageQuery) {
  return request({
    url: apiPrefix + 'list',
    method: 'post',
    data: query,
  })
}
export function GetObj(id: any) {
  return request({
    url: apiPrefix + id + '/',
    method: 'post',
  })
}

export function AddObj(obj: AddReq) {
  return request({
    url: apiPrefix,
    method: 'post',
    data: obj,
  })
}

export function UpdateObj(obj: EditReq) {
  return request({
    url: apiPrefix + obj.id + '/',
    method: 'put',
    data: obj,
  })
}

export function DelObj(id: DelReq) {
  return request({
    url: apiPrefix + id + '/',
    method: 'delete',
    data: { id },
  })
}

export function getAdStructureData(query: UserPageQuery) {
  return request({
    url: apiPrefix + 'structure',
    method: 'post',
    data: query,
  })
}
