import{n as o,o as u,p as c,q as a,t as n}from"./index-Cc987VYg.js";import{c as t}from"./cost-centers-CnOWN3vo.js";const l=e=>o({queryKey:["cost-centers",e],queryFn:()=>t.getAll(e)}),i=e=>o({queryKey:["cost-centers",e],queryFn:()=>t.getById(e),enabled:!!e}),q=e=>o({queryKey:["cost-centers","hierarchy",e],queryFn:()=>t.getHierarchy(e),enabled:!!e}),d=()=>o({queryKey:["cost-centers","tree"],queryFn:()=>t.getTree()}),g=(e,s)=>o({queryKey:["cost-centers",e,"costs",s],queryFn:()=>t.getCosts(e,s),enabled:!!e&&!!s}),m=()=>{const e=u();return c({mutationFn:s=>t.create(s),onSuccess:()=>{e.invalidateQueries({queryKey:["cost-centers"]}),n.success("Cost center created successfully")},onError:s=>{const r=a(s);n.error(r,{duration:5e3})}})},F=()=>{const e=u();return c({mutationFn:({id:s,data:r})=>t.update(s,r),onSuccess:()=>{e.invalidateQueries({queryKey:["cost-centers"]}),n.success("Cost center updated successfully")},onError:s=>{const r=a(s);n.error(r,{duration:5e3})}})},K=()=>{const e=u();return c({mutationFn:s=>t.delete(s),onSuccess:()=>{e.invalidateQueries({queryKey:["cost-centers"]}),n.success("Cost center deleted successfully")},onError:s=>{const r=a(s);n.error(r,{duration:5e3})}})};export{K as a,d as b,q as c,g as d,i as e,m as f,F as g,l as u};
