import{l as e}from"./index-Cc987VYg.js";const r="/cost-center/centers",i={getAll:async t=>{const{data:a}=await e.get(`${r}/`,{params:t});return a},getById:async t=>{const{data:a}=await e.get(`${r}/${t}/`);return a.data||a},create:async t=>{const{data:a}=await e.post(`${r}/`,t);return a},update:async(t,a)=>{const{data:n}=await e.put(`${r}/${t}/`,a);return n},delete:async t=>{const{data:a}=await e.delete(`${r}/${t}/`);return a},getHierarchy:async t=>{const{data:a}=await e.get(`${r}/${t}/hierarchy/`);return a},getCosts:async(t,a)=>{const{data:n}=await e.get(`${r}/${t}/costs/`,{params:{fiscal_year:a}});return n.data||n},getTree:async()=>{const{data:t}=await e.get(`${r}/`,{params:{page_size:1e3}}),a=t.results||t.data||t,n=(c,o=null)=>c.filter(s=>s.parent_cost_center_id===o).map(s=>({...s,children:n(c,s.id)}));return n(a,null)}};export{i as c};
