import request from '@/utils/request'

// 创建素材管理
export function createMaterialManagement(data) {
  return request({
    url: '/configure/material-management/create',
    method: 'post',
    data: data
  })
}

// 更新素材管理
export function updateMaterialManagement(data) {
  return request({
    url: '/configure/material-management/update',
    method: 'put',
    data: data
  })
}

// 批量移动素材管理分组
export function updateMaterialManagementGroupBatch(data) {
  return request({
    url: '/configure/material-management/update/batchGroup',
    method: 'put',
    data: data
  })
}

// 删除素材管理
export function deleteMaterialManagement(id) {
  return request({
    url: '/configure/material-management/delete?id=' + id,
    method: 'delete'
  })
}

// 批量删除素材管理
export function deleteMaterialManagementBatch(ids) {
  return request({
    url: '/configure/material-management/delete/batch?' + Object.keys(ids).map(key => key + '=' + ids[key]).join('&'),
    method: 'delete',
  })
}

// 获得素材管理
export function getMaterialManagement(id) {
  return request({
    url: '/configure/material-management/get?id=' + id,
    method: 'get'
  })
}

// 获得素材管理分页
export function getMaterialManagementPage(query) {
  return request({
    url: '/configure/material-management/page',
    method: 'get',
    params: query
  })
}

// 创建素材管理分组
export function createMaterialGroup(data) {
  return request({
    url: '/configure/material-group/create',
    method: 'post',
    data: data
  })
}

// 更新素材管理分组
export function updateMaterialGroup(data) {
  return request({
    url: '/configure/material-group/update',
    method: 'put',
    data: data
  })
}

// 删除素材管理分组
export function deleteMaterialGroup(id) {
  return request({
    url: '/configure/material-group/delete?id=' + id,
    method: 'delete'
  })
}

// 获得素材管理分组
export function getMaterialGroup(id) {
  return request({
    url: '/configure/material-group/get?id=' + id,
    method: 'get'
  })
}

// 获得素材管理分组分页
export function getMaterialGroupPage(query) {
  return request({
    url: '/configure/material-group/page',
    method: 'get',
    params: query
  })
}

// 获得素材管理分组列表
export function getMaterialGroupList(query) {
  return request({
    url: '/configure/material-group/list',
    method: 'get',
    params: query
  })
}
