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

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

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

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


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

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

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