import request from '@/config/axios'

// 课程-类型 VO
export interface BlocklyTypeVO {
  id: number // 课程类型id
  ctType: string, // 课程类型名称
  ctTypeNode: undefined, // 课程类型节点
  ctTypeSort: undefined, // 课程类型排序
  ctParentId: number, // 课程类型父级id
  ctTypeDescribe: string, // 课程类型描述
  tenantId: Number // 租户id
}

// 课程-类型 API
export const BlocklyTypeApi = {
  // 查询课程-类型列表
  getBlocklyTypeList: async (params) => {
    return await request.get({ url: `/blockly/blockly-type/list`, params })
  },
  // 查询课程-类型列表
  getBlocklyTypeSimpleList: async (params) => {
    return await request.get({ url: `/blockly/blockly-type/simple-list`, params })
  },

  // 查询课程-类型详情
  getBlocklyType: async (id: number) => {
    return await request.get({ url: `/blockly/blockly-type/get?id=` + id })
  },

  // 新增课程-类型
  createBlocklyType: async (data: BlocklyTypeVO) => {
    return await request.post({ url: `/blockly/blockly-type/create`, data })
  },

  // 修改课程-类型
  updateBlocklyType: async (data: BlocklyTypeVO) => {
    return await request.put({ url: `/blockly/blockly-type/update`, data })
  },

  // 删除课程-类型
  deleteBlocklyType: async (id: number) => {
    return await request.delete({ url: `/blockly/blockly-type/delete?id=` + id })
  },

  // 导出课程-类型 Excel
  exportBlocklyType: async (params) => {
    return await request.download({ url: `/blockly/blockly-type/export-excel`, params })
  },

  // 获取blockly课程列表
  getBlocklyTypeTree: async () => {
    return await request.get({ url: `/bjdxWeb/blockly/getBlocklyTypeTree`})
  }
}
