import { get, post, put, del, patch } from "../utils/request";

// Example API declarations. Replace paths with your backend endpoints.
export const api = {
  getPlcList(params: Object) {
    return get("/source", params);
  },
  createPlc(data: Object) {
    console.log("创建", data);
    return post("/source", data);
  },
  updatePlc(id: string, data: Object) {
    return put(`/source/${id}`, data);
  },
  deletePlc(id: string) {
    return del(`/source/${id}`);
  },
  getNodeTree(id: string) {
    return get(`/source/${id}/node-tree`);
  },
  pointCreate( data: Object) {
    return post(`/point`, data);
  },
  pointUpdate( id: String, data: Object) {
    return put(`/point/${id}`, data);
  },
  pointDel( id: String) {
    return del(`/point/${id}`);
  },
  pointList(params: Object) {
    return get("/point", params);
  },
  getPage(data: Object) {
    return get("/page", data);
  },
  pageCreate(data: Object){
    return post("/page", data);
  },
  pageUpdate(id:string,data: Object){
    return put(`/page/${id}`, data);
  },
  pageDel( id: String) {
    return del(`/page/${id}`);
  },
  unitList(params: Object) {
    return get("/unit", params);
  },
};

export default api;
