import{getRecords as a,getRecord as c,updateRecord as d}from"./common-DEIQtiPI.js";const n=async(s=1,e=10,r=[])=>{const t=await a("Local Scheduled Job",r,["name","method","frequency","cron_format","stopped","create_log","last_execution","server_script","scheduler_event","creation","modified"],"modified desc",(s-1)*e,e);if(!t.success)throw new Error(t.message||"获取 Scheduled Job 列表失败");return{items:t.data||[],total:t.total||0}},l=async s=>{const e=await c("Local Scheduled Job",s);if(!e.success)throw new Error(e.message||"获取 Scheduled Job 详情失败");return e.data},i=async s=>{try{const e=await c("Local Scheduled Job",s);if(!e.success)throw new Error("获取当前状态失败");const o=e.data.stopped||0?0:1,t=await d("Local Scheduled Job",s,{stopped:o});if(t.success)return{success:!0,message:`状态已更新为${o?"停止":"运行"}`};throw new Error(t.message||"更新状态失败")}catch(e){return console.error("Error in toggleScheduledJobStatus:",e),{success:!1,message:e.message||"更新状态失败"}}};export{l as a,n as g,i as t};
