import request from '@/utils/request'

// 数据集列表接口
export const datasetListAPI = (params) => request({
  url: '/smartPlatform/data/dataset/getDatasetList',
  method: 'get',
  params
})

// 数据集下拉选接口
export const getDatasetSelectListAPI = (params) => request({
  url: '/smartPlatform/data/dataset/getDatasetSelectList',
  method: 'get',
  params
})

// 数据集版本下拉选接口
export const getDatasetVersionSelectListAPI = (params) => request({
  url: '/smartPlatform/data/dataset/getDatasetVersionSelectList',
  method: 'get',
  params
})

// 删除数据集接口
export const delDatasetDataAPI = (data) => request({
  url: '/smartPlatform/data/dataset/delDatasetData',
  method: 'post',
  data
})

// 新增数据集接口
export const addDatasetDataAPI = (data) => request({
  url: '/smartPlatform/data/dataset/addDatasetData',
  method: 'post',
  data
})

// 编辑数据集接口
export const editDatasetDataAPI = (data) => request({
  url: '/smartPlatform/data/dataset/editDatasetData',
  method: 'post',
  data
})

// 查询数据集详情接口
export const getDatasetDetailAPI = (params) => request({
  url: '/smartPlatform/data/dataset/getDatasetDetail',
  method: 'get',
  params
})

// 数据集版本列表接口
export const datasetVersionListAPI = (params) => request({
  url: '/smartPlatform/data/dataset/getDatasetVersionList',
  method: 'get',
  params
})

// 新增数据集版本接口
export const addDatasetVersionDataAPI = (data) => request({
  url: '/smartPlatform/data/dataset/addDatasetVersionData',
  method: 'post',
  data
})

// 编辑数据集版本接口
export const editDatasetVersionDataAPI = (data) => request({
  url: '/smartPlatform/data/dataset/editDatasetVersionData',
  method: 'post',
  data
})

// 删除数据集版本接口
export const delDatasetVersionDataAPI = (data) => request({
  url: '/smartPlatform/data/dataset/delDatasetVersionData',
  method: 'post',
  data
})

// 查询数据集版本详情接口
export const getDatasetVersionDetailAPI = (params) => request({
  url: '/smartPlatform/data/dataset/getDatasetVersionDetail',
  method: 'get',
  params
})

/**
 * 根据数据集版本ID查询关联样本库列表
 * @param {Object} params - { datasetVersionId: 版本ID }
 * @returns {Promise}
 */
export const getSampleLibraryListByVersionIdAPI = (params) => request({
  url: '/smartPlatform/data/sample/getSampleLibraryListByVersionId',
  method: 'get',
  params
})

/**
 * 根据数据集版本ID查询关联样本图片列表（带分页）
 * @param {Object} params - { datasetVersionId: 版本ID, pageNum: 页码, pageSize: 页大小 }
 * @returns {Promise}
 */
export const getSampleListByVersionIdAPI = (params) => request({
  url: '/smartPlatform/data/sample/getSampleListByVersionId',
  method: 'get',
  params
})

/**
 * 新增：获取数据集已关联的样本库（用于减少版本数据时的回显）
 * @param {Object} params - { datasetId: 数据集ID }
 * @returns {Promise}
 */
export const getDatasetRelatedSampleLibsAPI = (params) => request({
  url: '/smartPlatform/data/sample/getSampleLibraryListByVersionId',
  method: 'get',
  params
})
