import{l as r,n as l,o as c,p as o,q as y,t as s}from"./index-Cc987VYg.js";import{t as g}from"./api-utils-SNhvzubv.js";const d={getEligibilities:async e=>{const{data:i}=await r.get("/ar/eligibility/",{params:e});return i},getEligibility:async e=>{const{data:i}=await r.get(`/ar/eligibility/${e}/`);return i},createEligibility:async e=>{const{data:i}=await r.post("/ar/eligibility/",e);return i},updateEligibility:async(e,i)=>{const{data:n}=await r.put(`/ar/eligibility/${e}/`,i);return n},deleteEligibility:async e=>{await r.delete(`/ar/eligibility/${e}/`)},verifyEligibility:async e=>{const{data:i}=await r.post(`/ar/eligibility/${e}/verify/`);return i}},u={getAll:async e=>{const{data:i}=await r.get("/ar/concurrent-reviews/",{params:g(e)});return i},getById:async e=>{const{data:i}=await r.get(`/ar/concurrent-reviews/${e}/`);return i},create:async e=>{const{data:i}=await r.post("/ar/concurrent-reviews/",e);return i},update:async(e,i)=>{const{data:n}=await r.put(`/ar/concurrent-reviews/${e}/`,i);return n},delete:async e=>{await r.delete(`/ar/concurrent-reviews/${e}/`)},getPending:async()=>{const{data:e}=await r.get("/ar/concurrent-reviews/pending/");return e},getExtensionNeeded:async()=>{const{data:e}=await r.get("/ar/concurrent-reviews/extension_needed/");return e}},t={all:["concurrent-reviews"],lists:()=>[...t.all,"list"],list:e=>[...t.lists(),e],details:()=>[...t.all,"detail"],detail:e=>[...t.details(),e],pending:()=>[...t.all,"pending"],extensionNeeded:()=>[...t.all,"extension"]};function E(e){return l({queryKey:t.list(e),queryFn:()=>u.getAll(e)})}function w(){return l({queryKey:t.pending(),queryFn:()=>u.getPending()})}function b(){return l({queryKey:t.extensionNeeded(),queryFn:()=>u.getExtensionNeeded()})}function f(e,i=!0){return l({queryKey:t.detail(e),queryFn:()=>u.getById(e),enabled:i&&!!e})}function p(){const e=c();return o({mutationFn:i=>u.create(i),onSuccess:()=>{e.invalidateQueries({queryKey:t.lists()}),e.invalidateQueries({queryKey:t.pending()}),e.invalidateQueries({queryKey:t.extensionNeeded()}),s.success("Concurrent review created successfully")},onError:i=>{const n=y(i);s.error(n,{duration:5e3})}})}function m(){const e=c();return o({mutationFn:({id:i,data:n})=>u.update(i,n),onSuccess:(i,n)=>{e.invalidateQueries({queryKey:t.lists()}),e.invalidateQueries({queryKey:t.detail(n.id)}),e.invalidateQueries({queryKey:t.pending()}),e.invalidateQueries({queryKey:t.extensionNeeded()}),s.success("Concurrent review updated successfully")},onError:i=>{const n=y(i);s.error(n,{duration:5e3})}})}function K(){const e=c();return o({mutationFn:i=>u.delete(i),onSuccess:()=>{e.invalidateQueries({queryKey:t.lists()}),e.invalidateQueries({queryKey:t.pending()}),e.invalidateQueries({queryKey:t.extensionNeeded()}),s.success("Concurrent review deleted successfully")},onError:i=>{const n=y(i);s.error(n,{duration:5e3})}})}const a={all:["eligibility-verifications"],lists:()=>[...a.all,"list"],list:e=>[...a.lists(),e],details:()=>[...a.all,"detail"],detail:e=>[...a.details(),e]};function C(e){return l({queryKey:a.list(e),queryFn:()=>d.getEligibilities(e),staleTime:3e4,retry:1})}function Q(e,i=!0){return l({queryKey:a.detail(e),queryFn:()=>d.getEligibility(e),enabled:i&&!!e})}function x(){const e=c();return o({mutationFn:i=>d.createEligibility(i),onSuccess:()=>{e.invalidateQueries({queryKey:a.lists()}),s.success("Eligibility verification created successfully")},onError:i=>{const n=y(i);s.error(n,{duration:5e3})}})}function F(){const e=c();return o({mutationFn:i=>d.verifyEligibility(i),onSuccess:()=>{e.invalidateQueries({queryKey:a.lists()}),s.success("Eligibility verification requested successfully")},onError:i=>{const n=y(i);s.error(n,{duration:5e3})}})}function R(){const e=c();return o({mutationFn:i=>d.deleteEligibility(i),onSuccess:()=>{e.invalidateQueries({queryKey:a.lists()}),s.success("Eligibility verification deleted successfully")},onError:i=>{const n=y(i);s.error(n,{duration:5e3})}})}export{Q as a,E as b,w as c,b as d,d as e,f,K as g,u as h,p as i,x as j,R as k,m as l,F as m,C as u};
