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

/**
 * 获取EntityAttr列表
 * @param data
 * @returns
 */
export function getEntityAttrByList(data: any) {
  return apiRequest({
    url: '/model/entity/attribute',
    method: 'GET',
    params: data,
  })
}

/**
 * 根据Id获取EntityAttr
 * @param modelId
 * @param entityId
 * @param attrId
 * @returns
 */
export function getEntityAttrById(modelId: number, entityId: number, attrId: number) {
  return apiRequest({
    url: `/model/entity/attribute/${modelId}/${entityId}/${attrId}`,
    method: 'GET',
  })
}

/**
 * 添加EntityAttr
 * @param data
 * @returns
 */
export function createEntityAttr(data: any) {
  return apiRequest({
    url: '/model/entity/attribute/add',
    method: 'POST',
    data,
  })
}

/**
 * 更新EntityAttr
 * @param data
 * @returns
 */
export function updateEntityAttr(data: any) {
  return apiRequest({
    url: '/model/entity/attribute/update',
    method: 'PUT',
    data,
  })
}

/**
 * 删除EntityAttr
 * @param modelId
 * @param entityId
 * @param attrId
 * @returns
 */
export function deleteEntityAttrById(modelId: number, entityId: number, attrId: number) {
  return apiRequest({
    url: `/model/entity/attribute/${modelId}/${entityId}/${attrId}`,
    method: 'DELETE',
  })
}
