import { addNoticeMethod, addSysConf, delNotice, getNoticeById, getNoticeMethod, getSysConf, updateNoticeLabel, updateNoticeMethod, updateNoticeStaus, updateSysConf } from '@/api/iot/sys'
import { message } from 'ant-design-vue'

export class SysController {
  static methodTypeList = ['EMAIL', 'WEBHOOK']

  static async sysConf () {
    return await getSysConf()
  }

  static async updateSysConf (data: IOT.API.SYS.Sys) {
    await updateSysConf(data)
    message.success('修改成功')
  }

  static async addSysConf (data: IOT.API.SYS.Sys) {
    await addSysConf(data)
    message.success('新增成功')
  }

  static async noticeMethodPage (params: any) {
    return await getNoticeMethod(params)
  }

  static async addNoticeMethod (data: any) {
    await addNoticeMethod(data)
    message.success('新增成功')
  }

  static async updateNoticeMethod (data: any) {
    await updateNoticeMethod(data)
    message.success('修改成功')
  }

  static async noticeById (id: string) {
    return await getNoticeById(id)
  }

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

  static async updateNoticeStaus (params: {id: string, status: string}) {
    await updateNoticeStaus(params)
    message.success('修改成功')
  }

  static async updateNoticeLabel (params: {id: string, label: string}) {
    await updateNoticeLabel(params)
    message.success('修改成功')
  }
}
