import{cancelAuditJob as e,discoverUrlsFromSitemap as t,getAuditJobStatus as n,pauseAuditJob as r,resumeAuditJob as i,startRecursiveAuditJob as a}from"../services/audit/recursiveAudit.service.mjs";const o=async(e,n)=>{let{url:r}=e.query;if(!r||typeof r!=`string`)return n.status(400).send({error:`URL is required`});try{new URL(r)}catch{return n.status(400).send({error:`Invalid URL format`})}try{let e=await t(r);return n.send({urls:e})}catch(e){return n.status(500).send({error:String(e)})}},s=async(e,t)=>{let{url:n}=e.query,{urls:r}=e.body??{},i=e.headers[`x-user-id`];if(!n||typeof n!=`string`)return t.status(400).send({error:`URL is required`});try{let e=await a(n,i,r);return t.send({jobId:e})}catch(e){return t.status(500).send({error:String(e)})}},c=async(e,t)=>{let{jobId:r}=e.params;if(!r)return t.status(400).send({error:`jobId is required`});try{let e=await n(r);return e?t.send(e):t.status(404).send({error:`Job not found`})}catch(e){return t.status(500).send({error:String(e)})}},l=async(t,n)=>{let{jobId:r}=t.params;if(!r)return n.status(400).send({error:`jobId is required`});try{return await e(r)?n.send({success:!0}):n.status(404).send({error:`Job not found`})}catch(e){return n.status(500).send({error:String(e)})}},u=async(e,t)=>{let{jobId:n}=e.params;if(!n)return t.status(400).send({error:`jobId is required`});try{return await r(n)?t.send({success:!0}):t.status(404).send({error:`Job not found`})}catch(e){return t.status(500).send({error:String(e)})}},d=async(e,t)=>{let{jobId:n}=e.params;if(!n)return t.status(400).send({error:`jobId is required`});try{return await i(n)?t.send({success:!0}):t.status(404).send({error:`Job not found`})}catch(e){return t.status(500).send({error:String(e)})}};export{l as cancelRecursiveAudit,o as discoverUrls,c as getRecursiveAuditStatus,u as pauseRecursiveAudit,d as resumeRecursiveAudit,s as startRecursiveAudit};
//# sourceMappingURL=recursiveAudit.controller.mjs.map