import { request } from "@/api/request";

/** 获取服务器列表（分页） */
export const fetchServerList = (params?: {
  page?: number;
  size?: number;
  keyword?: string;
  collect_on?: boolean;
}) => {
  return request.get("/DC-Control/v1/servers", { params });
};

/** 获取服务器详情 */
export const fetchServerDetail = (id: number) => {
  return request.get(`/DC-Control/v1/servers/${id}`);
};

/** 创建服务器 */
export const createServer = (data: any) => {
  return request.post("/DC-Control/v1/servers", data);
};

/** 更新服务器 */
export const updateServer = (id: number, data: any) => {
  return request.put(`/DC-Control/v1/servers/${id}`, data);
};

/** 删除服务器 */
export const deleteServer = (id: number) => {
  return request.delete(`/DC-Control/v1/servers/${id}`);
};
