import request from '@/config/axios'

// 课程 VO
export interface BlocklyVO {
  id: number // 课程d
  bcName: string // 课程名称
  bcContentType: "all", // 课程内容类型
  bcContent: string, // 课程内容

  blocklyInfo: string // 简介
  blocklyUserImage: string // 人物图标
  blocklyTileSize: string // 地图方格尺寸
  blocklyBackground: string // 地图背景图
  blocklyWalkablePoints: string // 地图可行走坐标
  blocklySpecialBlocks: string // 特殊方块
  blocklyRouteList: string // 地图路线

  bcIsInspect: false // 课程是否有检查
  bcType: number // 课程类型
  bcTypeName: string // 课程类型
  bcLabel: string // 课程标签
  bcOrder: number // 课程排序
  bcStatus: "0" // 课程状态
  tenantId: Number // 租户id
}

// 课程 API
export const BlocklyApi = {
  // 查询课程分页
  getBlocklyPage: async (params: any) => {
    return await request.get({ url: `/blockly/blockly/page`, params })
  },

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

  // 新增课程
  createBlockly: async (data: BlocklyVO) => {
    return await request.post({ url: `/blockly/blockly/create`, data })
  },

  // 修改课程
  updateBlockly: async (data: BlocklyVO) => {
    return await request.put({ url: `/blockly/blockly/update`, data })
  },

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

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

}
