import{a}from"./index-DOFLUERq.js";import{deleteRecords as c,getRecord as r}from"./common-DEIQtiPI.js";async function d(e=1,s=20,l="modified desc",n){try{const t=(await a.get("/api/action/jingrow.core.pagetype.local_job.local_job.get_local_job_list",{params:{limit_start:(e-1)*s,limit_page_length:s,order_by:l}})).data?.message||[];return{success:!0,items:t,total:t.length,page:e,page_length:s}}catch(o){throw new Error(o.response?.data?.message||o.message||"Failed to fetch local jobs")}}async function b(e){const s=await r("Local Job",e);if(s.success)return{success:!0,data:s.data};throw new Error(s.message||"Failed to fetch local job detail")}async function g(e){try{return{success:!0,message:(await a.post("/api/action/jingrow.core.pagetype.local_job.local_job.stop_job",{job_id:e})).data?.message||"Job stopped successfully"}}catch(s){return{success:!1,message:s.response?.data?.message||s.message||"Failed to stop job"}}}async function m(e){const s=await c("Local Job",[e]);return{success:s.success,message:s.message||(s.success?"Job deleted successfully":"Failed to delete job")}}async function p(e){const s=await c("Local Job",e);return{success:s.success,message:s.message||(s.success?"Jobs deleted successfully":"Failed to delete jobs"),success_count:s.success?e.length:0,failed_jobs:s.success?[]:e}}export{b as a,p as b,m as d,d as g,g as s};
