import { post, get } from '@/api/request';

const env = import.meta.env;
const PREFIX = env.VITE_API_PREFIX_SYSTEM;

// 获取所有应用
export const queryAllApplicationApi = () => {
  return get(`${PREFIX}appCenter/queryAllApplication`);
};

// 根据应用类型获应用
export const queryApplicationByTypeApi = (params: any) => {
  return get(`${PREFIX}appCenter/queryApplicationByType`, params);
};

// 添加应用
export const addApplicationApi = (params: any) => {
  return post(`${PREFIX}appCenter/addApplication`, params);
};

// 更新应用
export const updateApplicationApi = (params: any) => {
  return post(`${PREFIX}appCenter/updateApplication`, params);
};

// 删除应用
export const deleteApplicationApi = (params: any) => {
  return get(`${PREFIX}appCenter/deleteApplication`, params);
};

// 添加应用配置
export const addApplicationConfigApi = (params: any) => {
  return post(`${PREFIX}appCenter/addApplicationConfig`, params);
};

// 修改应用配置
export const updateApplicationConfigAPi = (params: any) => {
  return post(`${PREFIX}appCenter/updateApplicationConfig`, params);
};

// 获取应用配置
export const queryApplicationConfigApi = (params: any) => {
  return get(`${PREFIX}appCenter/queryApplicationConfig`, params);
};

// 删除某个应用配置
export const deleteApplicationConfigAPi = (params: any) => {
  return get(`${PREFIX}appCenter/deleteApplicationConfig`, params);
};

// 删除应用所有配置
export const deleteApplicationAllConfigApi = (params: any) => {
  return get(`${PREFIX}appCenter/deleteApplicationAllConfig`, params);
};
