import{l as n,m as o,n as i,p as c,t as g,q as p}from"./index-Cc987VYg.js";const s={getPayerAgingReport:async e=>{const{data:t}=await n.get(o.PAYER_AGING,{params:e});return t.data},getPayerAgingDetail:async(e,t)=>{const{data:r}=await n.get(`${o.PAYER_AGING}${e}/`,{params:t});return r.data},exportPayerAgingReport:async(e,t)=>{const{data:r}=await n.get(`${o.PAYER_AGING}export/`,{params:{...t,format:e},responseType:"blob"});return r}},u=e=>i({queryKey:["payerAging",JSON.stringify(e)],queryFn:()=>s.getPayerAgingReport(e),staleTime:60*1e3}),A=(e,t)=>i({queryKey:["payerAging","payer",e,JSON.stringify(t)],queryFn:()=>s.getPayerAgingDetail(e,t),enabled:!!e,staleTime:60*1e3}),d=()=>c({mutationFn:({format:e,filters:t})=>s.exportPayerAgingReport(e,t),onSuccess:(e,t)=>{const r=window.URL.createObjectURL(e),a=document.createElement("a");a.href=r,a.download=`payer-aging-report.${t.format}`,document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(r),g.success("Report exported successfully")},onError:e=>{g.error(p(e))}});export{u as a,d as b,A as u};
