import request from '@/utils/request'

// 查询完善列表重复组列表
export function listRepeat(query) {
  return request({
    url: '/toy/repeat/list',
    method: 'get',
    params: query
  })
}

// 查询完善列表重复组详细
export function getRepeat(id) {
  return request({
    url: '/toy/repeat/' + id,
    method: 'get'
  })
}

export function fetchRepeatGroupInfo(improvedParentId) {
  return request({
    url: `/toy/repeat/repeatGroupId/${improvedParentId}`,
    method: 'get'
  })
}
// 通过完善列表中的重复组id查询重复组
export function toyRepeatGroup(id) {
  return request({
    url: '/toy/repeat/toyGroupId/' + id,
    method: 'get'
  })
}

// 获取有待处理重复组的名称和数量
export function repeatNameAndCount() {
  return request({
    url: '/toy/repeat/selectToyBaseInfoImprovedRepeatNameAndCount',
    method: 'get'
  })
}

// 新增完善列表重复组
export function addRepeat(data) {
  return request({
    url: '/toy/repeat',
    method: 'post',
    data: data
  })
}

// 修改完善列表重复组
export function updateRepeat(data) {
  return request({
    url: '/toy/repeat',
    method: 'put',
    data: data
  })
}

// 删除完善列表重复组
export function removeRepeat(id) {
  return request({
    url: '/toy/repeat/' + id,
    method: 'delete'
  })
}

export function fetchRepeatBrand() {
  return request({
    url: '/toy/repeat/selectRepeatGroupBrandList',
    method: 'get'
  })
}

export function fetchRepeatGroupByBrandId(brandId) {
  return request({
    url: `/toy/repeat/selectRepeatGroupListByBrandId/${brandId}`,
    method: 'get'
  })
}

export function fetchRepeat(params) {
  return request({
    url: '/toy/improved/selectListByKeyWordIdAndBrandId',
    method: 'get',
    params: params
  })
}

export function fetchRepeatCount() {
  return request({
    url: '/toy/repeat/selectRepeatCount',
    method: 'get'
  })
}
