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

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

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

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

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

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

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