import service from '@/utils/request'

// 创建预设
export const createAiPreset = (data) => {
  return service({
    url: '/aiPreset/createAiPreset',
    method: 'post',
    data
  })
}

// 删除预设
export const deleteAiPreset = (data) => {
  return service({
    url: '/aiPreset/deleteAiPreset',
    method: 'delete',
    data
  })
}

// 更新预设
export const updateAiPreset = (data) => {
  return service({
    url: '/aiPreset/updateAiPreset',
    method: 'put',
    data
  })
}

// 查询预设
export const findAiPreset = (params) => {
  return service({
    url: '/aiPreset/findAiPreset',
    method: 'get',
    params
  })
}

// 获取预设列表
export const getAiPresetList = (params) => {
  return service({
    url: '/aiPreset/getAiPresetList',
    method: 'get',
    params
  })
}

// 导入预设(JSON粘贴)
export const importAiPreset = (data) => {
  return service({
    url: '/aiPreset/importAiPreset',
    method: 'post',
    data
  })
}

// 导入预设(文件上传)
export const importAiPresetFile = (file) => {
  const formData = new FormData()
  formData.append('file', file)
  return service({
    url: '/aiPreset/importAiPresetFile',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
