import {
  Workflow,
  WorkflowSearch,
} from "@/components/models/management/Workflow";
import { request } from "@/components/service/index";
export const WorkflowService = {
  add: (payload: Workflow) => {
    return request.post("/api/workflows", payload);
  },
  getAll: () => {
    return request.get("/api/workflows", {});
  },
  delete: (id: Number) => {
    return request.delete(`/api/workflows/${id}`, {});
  },
  view: (id: Number) => {
    return request.get(`/api/workflows/${id}`, {});
  },
  update: (id: number, payload: Workflow) => {
    return request.put(`/api/workflows/${id}`, payload);
  },
  search: (payload: WorkflowSearch) => {
    return request.get("/api/workflows/search", payload);
  },
  pipelineIdName: (pipelineId: string | number) => {
    return request.get(`/api/workflows/pipeline/${pipelineId}`, {});
  },
};
