import request from '@/utils/request/index'

/**
 * 获取知识点列表
 */
export const fetchKnowledgeList = (data: object) => {
  return request({
    url: '/cbs-app/knowledgePoint/page',
    method: 'post',
    data: data
  } as any)
}
/**
 * 新增知识点
 */
export const knowledgePointSave = (data: object) => {
  return request({
    url: '/cbs-app/knowledgePoint/save',
    method: 'post',
    data: data
  } as any)
}

// 删除知识点
export const fetchDelKnowledge = (data: object) => {
  return request({
    url: '/cbs-app/knowledgePoint/remove?id=' + data,
    method: 'post'
  })
}

/**
 * 知识点详情
 */
export const knowledgePointDetail = (data: any) => {
  return request({
    url: `/cbs-app/knowledgePoint/detail/${data}`,
    method: 'get'
  } as any)
}
/**
 * 知识点修改
 */
export const knowledgePointUpdate = (data: any) => {
  return request({
    url: `/cbs-app/knowledgePoint/update`,
    method: 'post',
    data
  } as any)
}
/**
 * 素材知识点关联列表
 */
export const knowledgePointMaterialRelationPage = (data: any) => {
  return request({
    url: `/cbs-app/knowledgePointMaterialRelation/page`,
    method: 'post',
    data
  } as any)
}

/**
 * 素材知识点移动数据存储
 */
export const knowledgePointMaterialRelationUpdate = (data: any) => {
  return request({
    url: `/cbs-app/knowledgePointMaterialRelation/update`,
    method: 'post',
    data
  } as any)
}

/**
 * 知识点删除素材关联
 */
export const knowledgePointMaterialRelationRemove = (data: any) => {
  return request({
    url: `/cbs-app/knowledgePointMaterialRelation/remove`,
    method: 'post',
    data
  } as any)
}

/**
 * 知识点素材分页查询
 */
export const knowledgePointMaterialRelationMaterialPage = (data: any) => {
  return request({
    url: `/cbs-app/knowledgePointMaterialRelation/materialPage`,
    method: 'post',
    data
  } as any)
}

/**
 * 素材关联知识点
 */
export const knowledgePointMaterialRelationSave = (data: any) => {
  return request({
    url: `/cbs-app/knowledgePointMaterialRelation/save`,
    method: 'post',
    data
  } as any)
}

/**
 * 知识点启用停用
 */
export const knowledgePointStatus = (data: any) => {
  return request({
    url: `/cbs-app/knowledgePoint/status?id=${data}`,
    method: 'post',
  } as any)
}
