import request from '../utils/request'

export function getModelList() {
  return request.get('/models')
}

export function createModel(data) {
  return request.post('/models', data)
}

export function updateModel(id, data) {
  return request.post(`/models/${id}/edit`, data)
}

export function deleteModel(id) {
  return request.post(`/models/${id}/delete`)
}

export function duplicateModel(id) {
  return request.post(`/models/${id}/duplicate`)
}

export function setDefaultModel(id) {
  return request.post(`/models/${id}/default`)
}

/** 测试已保存模型的连接 */
export function testModelConnection(id) {
  return request.post(`/models/${id}/test`)
}

/** 测试自定义配置的连接（新建/编辑时预验证） */
export function testConnection(data) {
  return request.post('/models/test', data)
}

/** 获取接口下可用的模型列表 */
export function fetchAvailableModels(data) {
  return request.post('/models/fetch-models', data)
}

export function updateModelPriorities(priorities) {
  return request.post('/models/priorities', priorities)
}
