import{b as c,c as i,a as d}from"./vendor-redux-a1f00e6b.js";import{f as r,b as p}from"./ContactService-92281a90.js";import{d as u}from"./AccountServices-62599aae.js";import{cq as D,F as g}from"./index-c62ac197.js";const o="ContactsData",s=c(`${o}/getContactsData`,async t=>(await D("apiCache-contactsData",t,p)).data),C=c(`${o}/getContactsAccountData`,async t=>{const a=await u(t);return console.log("accounts",a),a.data}),n=c(o+"/getContactDetails",async t=>(await r(t.id)).data),f={total:0,pageIndex:1,pageSize:10,query:"",sort:{order:"",key:""}},y={loading:!1,deleteConfirmation:!1,selectedRowData:"",tableData:f,filterData:{position:"",account:""},contactList:[],accountList:[]},l=i({name:`${o}`,initialState:y,reducers:{setTableData:(t,a)=>{t.tableData=a.payload},setFilterData:(t,a)=>{t.filterData=a.payload},toggleDeleteConfirmation:(t,a)=>{t.deleteConfirmation=a.payload},setSelectedRowData:(t,a)=>{t.selectedRowData=a.payload}},extraReducers:t=>{t.addCase(s.fulfilled,(a,e)=>{a.contactList=e.payload.$values,a.tableData.total=e.payload.$values.length,a.loading=!1}).addCase(s.pending,a=>{a.loading=!0}).addCase(s.rejected,(a,e)=>{a.contactList=[],a.loading=!1}).addCase(C.fulfilled,(a,e)=>{a.accountList=e.payload.$values}).addCase(n.fulfilled,(a,e)=>{a.contact=e.payload,a.loading=!1}).addCase(n.pending,a=>{a.loading=!0})}}),{setTableData:L,setFilterData:R,toggleDeleteConfirmation:$,setSelectedRowData:h}=l.actions,m=l.reducer,T=d({data:m}),v=g;export{C as a,s as b,R as c,n as g,T as r,h as s,$ as t,v as u};
