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

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

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

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

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

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