import{a as d}from"./vendor-utils-BveVE6Uf.js";import{e as P,bK as l,J as y}from"./index-IP_FWtso.js";const u=()=>{const{doctorId:s}=P(r=>r.doctorData),i=d.create({baseURL:"http://192.168.1.75:1401/api",headers:{...l(),DoctorId:s}});return i.interceptors.response.use(r=>{var n,c,a,o;return r.data.statusCode!==200&&y.error(`خطای سرو تامین اجتماعی : ${(o=(a=(c=(n=r==null?void 0:r.data)==null?void 0:n.data)==null?void 0:c.problems)==null?void 0:a.map(p=>p.error_Msg))==null?void 0:o.join(",")}`),r},r=>{try{const{status:n,data:c}=r.response;if(n===400){const a=c.errors.join(",");y.error(`خطای سرور تامین اجتماعی : ${a}`)}if(n===401){const a=document.createElement("a");a.href=`http://192.168.1.75:1401/Oauth/TaminLogin?returnUrl=${window.location.href}`,document.body.appendChild(a),a.click(),document.body.removeChild(a)}}catch{y.error(r==null?void 0:r.message)}return Promise.reject(r)}),{TaminAxios:i}},b=()=>{const{TaminAxios:s}=u();return{TaminSerivceDeliveryAuthStatus:async e=>(await s.get(`TaminSerivceDelivery/AuthStatus/Doctor/${e}`)).data,getAcceptableParTypesAsync:async()=>(await s.get("TaminSerivceDelivery/GetAcceptableParTypes")).data,getAcceptableParaServicesAsync:async()=>(await s.get("TaminSerivceDelivery/GetAcceptableParaServices")).data,getParaEPrescListAsync:async e=>(await s.get("TaminSerivceDelivery/GetParaEPrescList",{params:e})).data,getDeliveredParaclinicsAsync:async e=>(await d.get("TaminSerivceDelivery/GetDeliveredParaclinics",{params:e})).data,createParPrescAsync:async e=>(await s.post("TaminSerivceDelivery/CreateParPresc",e)).data,createLabPrescAsync:async e=>(await s.post("TaminSerivceDelivery/CreateLabPresc",e)).data,createPrescWithWarningAsync:async e=>(await s.post("TaminSerivceDelivery/CreateLabPresc",e)).data,deleteRegisteredPrescAsync:async e=>(await s.delete(`TaminSerivceDelivery/DelEpresc/${e}`)).data,createPhysioPrescAsync:async e=>(await s.post("TaminSerivceDelivery/CreatePhysioPresc",e)).data,createPhysioSessionAsync:async e=>(await s.post("TaminSerivceDelivery/CreatePhysioSession",e)).data,referRequestAsync:async e=>(await s.post("TaminSerivceDelivery/ReferRequest",e)).data,registerDiagnosisAsync:async e=>(await s.post("TaminSerivceDelivery/RegisterDiagnosis",e)).data,requestParPresAsnadByIdAsync:async e=>(await s.post("TaminSerivceDelivery/RequestParPresAsnadById",e)).data}};export{b as u};
