import apiRequest from '@/network/http/apiRequest'

/**
 * 获取Oc Category分页
 * @param data
 * @returns
 */
export function getOcCatByPage(data: any) {
  return apiRequest({
    url: '/oc/cat/page',
    method: 'GET',
    params: data,
  })
}

/**
 * 获取Oc Category列表
 * @param data
 * @returns
 */
export function getOcCatByList(data: any) {
  return apiRequest({
    url: '/oc/cat',
    method: 'GET',
    params: data,
  })
}

/**
 * 根据Id获取OC Category
 * @returns
 * @param ocTypeId
 * @param ocCatId
 */
export function getOcCatById(ocTypeId: number, ocCatId: number) {
  return apiRequest({
    url: `/oc/cat/${ocTypeId}/${ocCatId}`,
    method: 'GET',
  })
}

/**
 * 根据Id获取OC Category
 * @returns
 * @param ocTypeId
 */
export function getOcCatListById(ocTypeId: number) {
  return apiRequest({
    url: `/oc/cat/${ocTypeId}`,
    method: 'GET',
  })
}

/**
 * 添加Oc Category
 * @param data
 * @returns
 */
export function createOcCat(data: any) {
  return apiRequest({
    url: '/oc/cat/add',
    method: 'post',
    data,
  })
}

/**
 * 更新Oc Category
 * @param data
 * @returns
 */
export function updateOcCat(data: any) {
  return apiRequest({
    url: '/oc/cat/update',
    method: 'PUT',
    data,
  })
}

/**
 * 删除Oc Type
 * @returns
 * @param ocTypeId
 * @param ocCatId
 */
export function deleteOcCatById(ocTypeId: number, ocCatId: number) {
  return apiRequest({
    url: `/oc/cat/${ocTypeId}/${ocCatId}`,
    method: 'DELETE',
  })
}
