import axios from 'axios';
import { apiResData, monitorCfg, querySceneParams } from '@/api/interface/index';

export interface sceneModel {
  id?: string;
  name?: string;
  description?: string;
  identify?: string;
  logo?: string;
  published?: boolean | number;
  createBy?: string;
  createTime?: string;
  updateBy?: string;
  updateTime?: string;
  createUser?: string;
  configUrls?: Array<monitorCfg>;
}

const urlPrefix = '/api/v1/bpms-workbench';

// 场景管理-个人分页
export function getMySceneList(data: querySceneParams) {
  return axios.post<apiResData>(`${urlPrefix}/scenes/minePage`, data);
}

// 场景管理-公共分页
export function getPublicSceneList(data: querySceneParams) {
  return axios.post<apiResData>(`${urlPrefix}/scenes/publicPage`, data);
}

// 场景管理-协同分页
export function getTeamSceneList(data: querySceneParams) {
  return axios.post<apiResData>(`${urlPrefix}/scenes/teamPage`, data);
}

// 场景管理-获取场景
export function getScene(appId: string) {
  return axios.get(`${urlPrefix}/scenes$${appId}`);
}

// 场景管理-新增场景
export function addScene(data: sceneModel) {
  return axios.post(`${urlPrefix}/scenes`, data);
}

// 场景管理-修改场景
export function editScene(data: sceneModel) {
  return axios.put(`${urlPrefix}/scenes`, data);
}

// 场景管理-删除场景
export function deleteScene(id: string) {
  return axios.delete(`${urlPrefix}/scenes/${id}`);
}

// 场景管理-获取场景名和对应的ID
export function getSceneAndId() {
  return axios.get(`${urlPrefix}/scenes/idAndName`);
}