import http from '@/utils/http'
import type { ModelConfigRequest, ModelConfigResponse, ModelConfigListResponse, ModelConfigDetailResponse } from './type'

const { request } = http

/**
 * 创建模型配置
 * @param data 模型配置数据
 */
export function createModelConfig(data: ModelConfigRequest) {
  return request<ModelConfigResponse>({
    url: '/model-config',
    method: 'post',
    data
  })
}

/**
 * 更新模型配置
 * @param data 模型配置数据
 */
export function updateModelConfig(data: ModelConfigRequest) {
  return request<ModelConfigResponse>({
    url: '/model-config',
    method: 'put',
    data
  })
}

/**
 * 获取模型配置列表
 * @param params 查询参数
 */
export function getModelConfigList(params?: {
  confThreshold?: number
  keyword?: string
  modelId?: string
  modelName?: string
  modelPath?: string
  nmsThreshold?: number
  page?: number
  pageSize?: number
}) {
  return request<ModelConfigListResponse>({
    url: '/model-config/list',
    method: 'get',
    params
  })
}

/**
 * 获取模型配置详情
 * @param modelId 模型ID
 */
export function getModelConfigDetail(modelId: string) {
  return request<ModelConfigDetailResponse>({
    url: `/model-config/${modelId}`,
    method: 'get'
  })
}

/**
 * 删除模型配置
 * @param modelId 模型ID
 */
export function deleteModelConfig(modelId: string) {
  return request<any>({
    url: `/model-config/${modelId}`,
    method: 'delete'
  })
} 