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

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

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

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

/**
 * 根据Id获取Object
 * @param modelId
 * @returns
 */
export function getObjectListById(modelId: number) {
  return apiRequest({
    url: `/model/object/${modelId}`,
    method: 'GET',
  })
}

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

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

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

/**
 * 更新Object
 * @param modelId
 * @param objectId
 * @param status
 * @returns
 */
export function updateObjectStatus(modelId: number, objectId: number, status: number) {
  return apiRequest({
    url: `/model/object/updateStatus/${modelId}/${objectId}/${status}`,
    method: 'PUT',
  })
}

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