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

/**
 * 获取Object分页
 * @param data
 * @returns
 */
export function getObjectByPage(data: any) {
  return apiRequest({
    url: '/biz/object/page',
    method: 'GET',
    params: data,
  })
}

/**
 * 获取Object列表
 * @param data
 * @returns
 */
export function getObjectByList(data: any) {
  return apiRequest({
    url: '/biz/object',
    method: 'GET',
    params: data,
  })
}

/**
 * 获取Object列表
 * @param bizId
 * @returns
 */
export function getObjectListById(bizId: number) {
  return apiRequest({
    url: `/biz/object/${bizId}`,
    method: 'GET',
  })
}


/**
 * 根据Id获取Biz Object
 * @param bizId
 * @param objectId
 * @returns
 */
export function getObjectById(bizId: number, objectId: number) {
  return apiRequest({
    url: `/biz/object/${bizId}/${objectId}`,
    method: 'GET',
  })
}

/**
 * 添加Object
 * @param data
 * @returns
 */
export function createObject(data: any) {
  return apiRequest({
    url: '/biz/object/add',
    method: 'POST',
    data,
  })
}

/**
 * 更新Object
 * @param data
 * @returns
 */
export function updateObject(data: any) {
  return apiRequest({
    url: '/biz/object/update',
    method: 'PUT',
    data,
  })
}

/**
 * 删除Object
 * @param bizId
 * @param objectId
 * @returns
 */
export function deleteObjectById(bizId: number, objectId: number) {
  return apiRequest({
    url: `/biz/object/${bizId}/${objectId}`,
    method: 'DELETE',
  })
}
