import{b8 as u}from"./index-DlNZgIG9.js";const n="ADMIN",e=u.injectEndpoints({endpoints:i=>({getGreenEcoNotifications:i.query({query:t=>`notification?recipient=${n}&size=${(t==null?void 0:t.size)??30}`,providesTags:["ProductionNotification"]}),getGreenEcoUnreadCount:i.query({query:()=>`notification/unread-count?recipient=${n}`,providesTags:["ProductionNotification"]}),markGreenEcoNotificationRead:i.mutation({query:({id:t})=>({url:`notification/${t}/read`,method:"PUT"}),async onQueryStarted(t,{dispatch:a,queryFulfilled:c}){const r=a(e.util.updateQueryData("getGreenEcoUnreadCount",void 0,o=>{o&&o.unreadCount>0&&(o.unreadCount-=1)}));try{await c}catch{r.undo()}},invalidatesTags:["ProductionNotification"]}),markAllGreenEcoNotificationsRead:i.mutation({query:()=>({url:`notification/read-all?recipient=${n}`,method:"PUT"}),invalidatesTags:["ProductionNotification"]}),triggerGreenEcoNotificationScan:i.mutation({query:()=>({url:"notification/scan",method:"POST"}),invalidatesTags:["ProductionNotification"]})})}),{useGetGreenEcoNotificationsQuery:d,useLazyGetGreenEcoNotificationsQuery:f,useGetGreenEcoUnreadCountQuery:N,useMarkGreenEcoNotificationReadMutation:E,useMarkAllGreenEcoNotificationsReadMutation:G,useTriggerGreenEcoNotificationScanMutation:y}=e;export{N as a,E as b,G as c,y as d,d as u};
