import request from '@/utils/request'

// 查询列表
export function listType(query) {
  return request({
    url: '/api/sc/course/type/list/searchList',
    method: 'get',
    params: query
  })
}

// 查询列表
export function select(query) {
  return request({
    url: '/api/sc/course/type/list/select',
    method: 'get',
    params: query
  })
}

export function selectForCheckbox() {
  return request({
    url: '/api/sc/course/type/list/selectForCheckbox',
    method: 'get'
  })
}

export function selectByTypeIds(query) {
  return request({
    url: '/api/sc/course/type/list/selectByTypeIds',
    method: 'get',
    params: query
  })
}

// 查询详细
export function getType(courseTypeId) {
  return request({
    url: '/api/sc/course/type/info/detailById/' + courseTypeId,
    method: 'get'
  })
}

// 新增
export function addType(data) {
  return request({
    url: '/api/sc/course/type/add/addScCourseType',
    method: 'post',
    data: data
  })
}

// 修改
export function updateType(data) {
  return request({
    url: '/api/sc/course/type/update/updateScCourseType',
    method: 'put',
    data: data
  })
}

// 删除
export function delType(courseTypeId) {
  return request({
    url: '/api/sc/course/type/delete/deleteById/' + courseTypeId,
    method: 'delete'
  })
}

// 导出
export function exportType(query) {
  return request({
    url: '/api/sc/course/type/export',
    method: 'get',
    params: query
  })
}

// 是否开售
export function changeCourseTypeSale(courseTypeId, inUse) {
  return request({
    url: '/api/sc/course/type/changeCourseTypeSale',
    method: 'put',
    data: {
      courseTypeId,
      inUse
    }
  })
}
