import{aj as T,r as u,y as r,z as n}from"./index-Bb2UEb_P.js";const F=T("services",()=>{const i=u({}),d=u({}),S=u([]),f=u(null),O=u({}),p=u(null),R=u({}),E=u({}),P=u({});async function h(){if(!(Object.keys(i.value).length>0))try{const e=await r.post(n.services);e?.data?i.value=e.data:i.value={}}catch(e){console.error("Ошибка при загрузке сервисов:",e),i.value={}}}async function y(){const e=await r.post(n.DNSmanagerOrders);f.value=e.data}async function w(){const e=await r.post(n.ExtraIPOrders);O.value=e.data}async function m(){const e=await r.post(n.DNSmanagerSchemes);P.value=e.data}async function v(){const e=await r.post(n.ISPswOrders);p.value=e.data}async function k(e){let t="ERROR",a=null,s=null,o=null,{Code:c="Default"}=e;c==="Default"?o=n.ServiceOrder:o="/API/"+c+"Order";const l=await r.post(o,e);return l.data?.Status==="Ok"?(t="SUCCESS",s=l.data):(a=l.data?.Exception.String,console.error(a)),{result:t,info:s,error:a}}async function I(e){let t="ERROR",a=null,s=null;const o=await r.post(n.DNSmanagerOrder,e);return o.data?.Status==="Ok"?(t="SUCCESS",s=o?.data):a=o?.data?.Exception,{result:t,info:s,error:a}}async function C(e){let t="ERROR",a=null,s=null,o=null,{Code:c="Default"}=e;c==="Default"?o=n.ExtraIPOrder:o="/API/"+c+"Order";const l=await r.post(o,e);return l?.data?.Status==="Ok"?(t="SUCCESS",s=l?.data):a=l?.data?.Exception,{result:t,info:s,error:a}}async function D(e){let t="ERROR",a=null,s=null,o=null,{Code:c="Default"}=e;c==="Default"?o=n.ISPswOrder:o="/API/"+c+"Order";const l=await r.post(o,e);return l?.data?.Status==="Ok"?(t="SUCCESS",s=l?.data):a=l?.data?.Exception,{result:t,info:s,error:a}}async function U(e){let t="ERROR";const a=await r.post(n.ExtraIPOrderPay,e);return a?.data?.Status==="UseBasket"&&(t="UseBasket"),a?.data?.Status==="NoBasket"&&(t="NoBasket"),a?.data?.Status==="Ok"&&(t="NoBasket"),t}async function N(e){let t="ERROR";const a=await r.post(n.ISPswOrderPay,e);return a?.data?.Status==="UseBasket"&&(t="UseBasket"),a?.data?.Status==="NoBasket"&&(t="NoBasket"),a?.data?.Status==="Ok"&&(t="NoBasket"),t}async function g(e){let t="ERROR";const a=await r.post(n.DNSmanagerOrderPay,e);return a?.data?.Status==="UseBasket"&&(t="UseBasket"),a?.data?.Status==="NoBasket"&&(t="NoBasket"),a?.data?.Status==="Ok"&&(t="NoBasket"),t}async function x(e="Default",t){let a=null,s=null;const o=e==="Default"?n.ServiceOrderPay:"/API/"+e+"OrderPay",c=await r.post(o,t);return c.data?.Status==="Ok"?a="SUCCESS":c.data?.Status==="UseBasket"?a="BASKET":(a="ERROR",s=c.data?.Exception.String),{result:a,error:s}}async function B(e){let t="ERROR",a=null;const s=await r.post("/API/v2/"+e+"Schemes",{});return s.data?(t="SUCCESS",d.value[e]=s?.data):a=s?.data?.Exception,{result:t,error:a}}async function L(){const e=await r.post(n.ExtraIPSchemes);R.value=e.data}async function A(){const e=await r.post(n.ISPswSchemes);E.value=e.data}async function j(e){let t="ERROR",a=null;return(await r.post(n.DNSmanagerOrderSchemeChange,e))?.data?.Status==="Ok"&&(t="SUCCESS"),{result:t,error:a}}async function b(e){let t="ERROR",a=null;return(await r.post(n.ISPswOrderSchemeChange,e))?.data?.Status==="Ok"&&(t="SUCCESS"),{result:t,error:a}}async function z(e){try{const t=await r.post(n.DependServices,e);return t?.data?(S.value=t.data,{result:"SUCCESS",error:null}):(S.value=[],{result:"ERROR",error:t?.data?.Exception})}catch(t){return console.error("Ошибка при загрузке зависимых сервисов:",t),S.value=[],{result:"ERROR",error:t.message}}}async function K(e){return(await r.post(n.updateResourcesUsed,{Orders:e})).data}return{ServicesList:i,ISPswOrdersList:p,DNSmanagerOrdersList:f,DependServicesList:S,ExtraIPOrdersList:O,additionalServicesScheme:d,extraIPSchemes:R,ISPswSchemes:E,DNSmanagerSchemes:P,fetchAdditionalServiceScheme:B,fetchDependServices:z,fetchServices:h,ServiceOrder:k,serviceOrderPay:x,DNSmanagerOrder:I,ISPswOrder:D,ExtraIPOrder:C,fetchDNSmanagerOrders:y,DNSmanagerOrderSchemeChange:j,fetchISPswOrders:v,ISPswOrderSchemeChange:b,ISPswOrderPay:N,DNSmanagerOrderPay:g,fetchExtraIPOrders:w,ExtraIPOrderPay:U,updateResourcesUsed:K,fetchExtraIPSchemes:L,fetchISPswSchemes:A,fetchDNSmanagerSchemes:m}});export{F as u};
