import { get, del, post, put } from '/@/utils/request';

export default {
  list: (params: object) => get('/projects/list', params),
  getProjectResourcesByCode: (params: object) => get('/projects/getProjectResourcesByCode', params),
  detail: (code: string) => get('/projects/getByCode', { code }),
  del: (ids: number[]) => del('/projects/del', { ids }),
  bindResources: (data: object) => post('/projects/bindResources', data),
  unbindResources: (data: object) => del('/projects/unbindResources', data),
  add: (data: object) => post('/projects/add', data),
  edit: (data: object) => put('/projects/edit', data),
  editStatus: (data: object) => put('/projects/editStatus', data),
  template: {
    list: (params: object) => get('/projects/devDeviceAttributeTemplates/list', params),
    add: (data: object) => post('/projects/devDeviceAttributeTemplates/add', data),
    bindDevices: (data: object) => post('/projects/devDeviceAttributeTemplates/bindDevices', data),
    edit: (data: object) => put('/projects/devDeviceAttributeTemplates/edit', data),
    del: (ids: number[]) => del('/projects/devDeviceAttributeTemplates/del', { ids }),
    editStatus: (data: object) => put('/projects/devDeviceAttributeTemplates/editStatus', data),
    detail: (id: string) => get('/projects/devDeviceAttributeTemplates/getById', { id }),
    getBindDevices: (params: object) => get('/projects/devDeviceAttributeTemplates/getBindDevices', params),
    unBindDevices: (data: object) => post('/projects/devDeviceAttributeTemplates/unBindDevices', data),
    attr: {
      list: (params: object) => get('/projects/devDeviceAttributeValues/list', params),
      add: (data: object) => post('/projects/devDeviceAttributeValues/add', data),
      edit: (data: object) => put('/projects/devDeviceAttributeValues/edit', data),
      del: (ids: number[]) => del('/projects/devDeviceAttributeValues/del', { ids }),
      editStatus: (data: object) => put('/projects/devDeviceAttributeValues/editStatus', data),
      editIsVisible: (data: object) => put('/projects/devDeviceAttributeValues/editIsVisible', data),
      detail: (id: string) => get('/projects/devDeviceAttributeValues/getById', { id }),
    }
  },
  screen: {
    devParts: (params?: object) => get('/projects/devParts/list', params),
    projects: (params?: object) => get('/projects/list', params),
    projectDevices: (projectsCode: string) => get('/projects/getProjectResourcesByCode', { projectsCode }),
    getProjectInfoByCode: (propertiyKeys: string[] = []) => get('/projects/screen/getProjectInfoByCode', { propertiyKeys, status: 1 }),
    projectDevicesList: (keys: string[]) => get('/product/device/page_list', { keys, pageSize: 500 }),
    projectDetail: (code: string) => get('/projects/getByCode', { code }),
    deviceDetail: (deviceKey: string) => get('/projects/screen/getDeviceInfoByKey', { deviceKey }),
    propertyList: (deviceKey: string) => get('/projects/device/tsl/property/list', { deviceKey, pageSize: 500 }),
    propertyListValue: (projectCode: string, deviceKey: string) => get('/projects/screen/getDeviceDetailDataByLatest', { projectCode, deviceKey }),
    deviceList: (projectsCode?: string) => get('/projects/getProjectDeviceByCode', { projectsCode }),
    chartData: (params: object) => get('/analysis/multiAttributeDeviceIndicatorTrend', params),
    deviceInfo: (deviceKey: string) => get('/product/device/detail', { deviceKey }),
    alarmCount: (deviceKey?: string) => get('/projects/screen/deviceAlarmTotalCount', { deviceKey }),
    statistics: (params?: object) => get('/projects/screen/getBoilerStatistics', params),
    getDeviceDetailDataByLatest: (params?: object) => get('/projects/screen/getDeviceDetailDataByLatest', params),
  },
}