import apiRequest from '@/network/http/apiRequest'

/**
 * 获取Model列表
 * @param data
 * @returns
 */
export function getModelByList(data: any) {
  return apiRequest({
    url: '/model',
    method: 'GET',
    params: data,
  })
}

/**
 * 根据Id获取Model
 * @param modelId
 * @returns
 */
export function getModelById(modelId: number) {
  return apiRequest({
    url: `/model/${modelId}`,
    method: 'GET',
  })
}

/**
 * 获取模型树视图
 * @returns
 */
export function getModelTreeData() {
  return apiRequest({
    url: '/model/data',
    method: 'GET',
  })
}

/**
 * 添加Model
 * @param data
 * @returns
 */
export function createModel(data: any) {
  return apiRequest({
    url: '/model/add',
    method: 'POST',
    data,
  })
}

/**
 * 更新Model
 * @param data
 * @returns
 */
export function updateModel(data: any) {
  return apiRequest({
    url: '/model/update',
    method: 'PUT',
    data,
  })
}

/**
 * 更新Model
 * @param modelId
 * @param status
 * @returns
 */
export function updateModelStatus(modelId: number, status: number) {
  return apiRequest({
    url: `/model/updateStatus/${modelId}/${status}`,
    method: 'PUT',
  })
}

/**
 * 删除Model
 * @param modelId
 * @returns
 */
export function deleteModelById(modelId: number) {
  return apiRequest({
    url: `/model/${modelId}`,
    method: 'DELETE',
  })
}
