
import { addModelAttribute, getModelAttribute, updateModelAttribute, delModelAttribute, getModelAttributeList } from '@/api/iot/model'
import { message } from 'ant-design-vue'

export class ModelAttrController {
  static async page (params: any) {
    return await getModelAttribute(params)
  }

  static async post (data: IOT.API.MODELATTR.ModelAttr & {modelId: string}) {
    await addModelAttribute(data)
    message.success('新增成功')
  }

  static async update (data: IOT.API.MODELATTR.ModelAttr & {modelId: string}) {
    await updateModelAttribute(data)
    message.success('修改成功')
  }

  static async del (id: string) {
    await delModelAttribute(id)
    message.success('删除成功')
  }

  static async list (params: {modelId: string, excludeRts: boolean} = { modelId: '', excludeRts: false }) {
    return await getModelAttributeList(params)
  }
}
