import{b as i,c,a as p}from"./vendor-redux-a1f00e6b.js";import{a as C,e as f,f as g}from"./CourseService-f0dc3bf1.js";import{F as D}from"./index-c62ac197.js";const o="CourseData",l=i(`${o}/getCourseList`,async a=>(await C({filters:a==null?void 0:a.filters})).data),d=i(o+"/getCourseDetails",async a=>(await f(a.id)).data),r=i(o+"/getCourseOptions",async(a,{rejectWithValue:e})=>{try{return(await g(a.id)).data}catch(s){return e(s)}}),y={total:0,pageIndex:1,pageSize:10,query:"",sort:{order:"",key:""}},m={loading:!1,deleteConfirmation:!1,selectedRowData:"",tableData:y,filterData:{name:"",category:["bags","cloths","devices","shoes","watches"],status:[0,1,2],productStatus:0},CourseList:[],CourseDetails:{},paymentList:[],CourseOptionList:[]},u=c({name:`${o}`,initialState:m,reducers:{setTableData:(a,e)=>{a.tableData=e.payload},setFilterData:(a,e)=>{a.filterData=e.payload},toggleDeleteConfirmation:(a,e)=>{a.deleteConfirmation=e.payload},setSelectedRowData:(a,e)=>{a.selectedRowData=e.payload}},extraReducers:a=>{a.addCase(l.fulfilled,(e,s)=>{var t;e.CourseList=(t=s.payload.finalResults)==null?void 0:t.$values,e.tableData.total=s.payload.finalResults.$values.length,e.loading=!1}).addCase(l.pending,e=>{e.loading=!0}).addCase(l.rejected,e=>{e.loading=!1}).addCase(d.fulfilled,(e,s)=>{e.CourseDetails=s.payload,e.loading=!1}).addCase(d.pending,e=>{e.loading=!0}).addCase(r.pending,e=>{e.loading=!0}).addCase(r.fulfilled,(e,s)=>{var t,n;e.CourseOptionList=(n=(t=s==null?void 0:s.payload)==null?void 0:t.finalResults)==null?void 0:n.$values,e.loading=!1}).addCase(r.rejected,(e,s)=>{e.CourseOptionList=[],e.loading=!1})}}),{setTableData:w,setFilterData:h,toggleDeleteConfirmation:O,setSelectedRowData:$}=u.actions,b=u.reducer,v=p({data:b}),A=D;export{r as a,d as b,l as g,v as r,$ as s,O as t,A as u};
