import{al as D,r as o,am as r,an as n}from"./index-CipWZKo_.js";const M=D("EDesks",()=>{const i=o(null),u=o(null),c=o(null);async function k(){let e="error";return await r.post(n.eDesks).then(t=>{i.value=t?.data}).catch(()=>{e="error"}),e}async function f(e){let t="error";return await r.get(n.eDeskMessages+`?EdeskID=${e}`).then(s=>{u.value=s?.data,t="success"}).catch(()=>{t="error"}),t}function l(e){let t=new FormData;for(let s in e)t.append(s,e[s]);return t}async function p(e){let t="error",s=l(e);return e?.TicketMessageFile&&e?.TicketMessageFile.forEach(a=>{s.append("TicketMessageFile[]",a)}),await r.post(n.sendTicketMessage,s).then(a=>{t="success"}).catch(()=>{t="error"}),t}async function h(){let e="error";return await r.post(n.ticketGroups).then(t=>{t?.data&&(c.value=t.data,e="success")}).catch(()=>{e="error"}),e}async function d(e){let t="error",s=l(e);return e?.TicketMessageFile&&e?.TicketMessageFile.forEach(a=>{s.append("TicketMessageFile[]",a)}),await r.post(n.ticketEdit,s).then(a=>{a?.data.Status==="Ok"&&(c.value=a.data,t="success")}).catch(()=>{t="error"}),t}return{eDesksList:i,eDeskMessages:u,eDeskGroups:c,fetchEDesks:k,fetchEDeskMessages:f,sendTicketMessage:p,fetchTicketGroups:h,ticketEdit:d}});export{M as u};
