import{t as e}from"./api-DAEUkJit.js";var{useListOrdersQuery:t,useGetOrderQuery:n,useGetOrderInvoicesQuery:r,useMyCustomerQuery:i,useCreateOrderMutation:a,useUpdateOrderMutation:o,useDeleteOrderMutation:s,useOrderTransitionMutation:c,useStockAvailabilityQuery:l,usePreviewOrderMutation:u,useOrdersConfigQuery:d,useOrderBookQuery:f,useDecideApprovalMutation:p,useListOrderAttachmentsQuery:m,useOrderAttachmentsByOrderQuery:h,useCreateOrderAttachmentMutation:g,useUpdateOrderAttachmentMutation:_,useDeleteOrderAttachmentMutation:v,useFrequentProductsQuery:y,usePendingDispatchQuery:b}=e.injectEndpoints({endpoints:e=>({getOrderInvoices:e.query({query:e=>`/orders/${e}/invoices/`,providesTags:(e,t,n)=>[{type:`Order`,id:n}]}),listOrders:e.query({query:e=>({url:`/orders/`,params:e||void 0}),providesTags:e=>e?[...e.results.map(({id:e})=>({type:`Order`,id:e})),{type:`Order`,id:`LIST`}]:[{type:`Order`,id:`LIST`}]}),getOrder:e.query({query:e=>`/orders/${e}/`,providesTags:(e,t,n)=>[{type:`Order`,id:n}]}),myCustomer:e.query({query:()=>`/orders/my-customer/`}),createOrder:e.mutation({query:e=>({url:`/orders/`,method:`POST`,body:e}),invalidatesTags:[{type:`Order`,id:`LIST`}]}),updateOrder:e.mutation({query:({id:e,body:t})=>({url:`/orders/${e}/`,method:`PATCH`,body:t}),invalidatesTags:(e,t,{id:n})=>[{type:`Order`,id:n},{type:`Order`,id:`LIST`}]}),deleteOrder:e.mutation({query:e=>({url:`/orders/${e}/`,method:`DELETE`}),invalidatesTags:[{type:`Order`,id:`LIST`}]}),orderTransition:e.mutation({query:({id:e,action:t,reason:n})=>({url:`/orders/${e}/${t}/`,method:`POST`,body:n?{reason:n}:void 0}),invalidatesTags:(e,t,{id:n})=>[{type:`Order`,id:n},{type:`Order`,id:`LIST`}]}),stockAvailability:e.query({query:e=>({url:`/erp-sync/stock/availability/`,params:{warehouse:e}}),transformResponse:e=>e.data,providesTags:[{type:`Stock`,id:`AVAILABILITY`}]}),previewOrder:e.mutation({query:e=>({url:`/orders/preview/`,method:`POST`,body:e})}),orderBook:e.query({query:e=>({url:`/orders/order-book/`,params:e||void 0}),providesTags:[{type:`Order`,id:`LIST`},{type:`Stock`,id:`LIST`}]}),ordersConfig:e.query({query:()=>`/orders/config/`,providesTags:[{type:`Setting`,id:`SYSTEM`}]}),decideApproval:e.mutation({query:({requestId:e,decision:t,comment:n})=>({url:`/workflow/approval-requests/${e}/${t}/`,method:`POST`,body:{comments:n||``}}),invalidatesTags:(e,t,{orderId:n})=>[{type:`Order`,id:n},{type:`Order`,id:`LIST`}]}),listOrderAttachments:e.query({query:e=>({url:`/orders/attachments/`,params:e||void 0}),providesTags:[{type:`OrderAttachment`,id:`LIST`}]}),orderAttachmentsByOrder:e.query({query:e=>`/orders/attachments/by-order/${e}/`,transformResponse:e=>e.data,providesTags:(e,t,n)=>[{type:`OrderAttachment`,id:n}]}),createOrderAttachment:e.mutation({query:e=>({url:`/orders/attachments/`,method:`POST`,body:e}),invalidatesTags:e=>[{type:`OrderAttachment`,id:`LIST`},...e?[{type:`OrderAttachment`,id:e.order}]:[]]}),updateOrderAttachment:e.mutation({query:({id:e,body:t})=>({url:`/orders/attachments/${e}/`,method:`PATCH`,body:t}),invalidatesTags:e=>[{type:`OrderAttachment`,id:`LIST`},...e?[{type:`OrderAttachment`,id:e.order}]:[]]}),deleteOrderAttachment:e.mutation({query:({id:e})=>({url:`/orders/attachments/${e}/`,method:`DELETE`}),invalidatesTags:(e,t,{orderId:n})=>[{type:`OrderAttachment`,id:`LIST`},{type:`OrderAttachment`,id:n}]}),frequentProducts:e.query({query:e=>`/orders/frequent-products/?customer=${e}`,providesTags:(e,t,n)=>[{type:`Order`,id:`frequent-${n}`}]}),pendingDispatch:e.query({query:e=>`/orders/pending-dispatch/?customer=${e}`,providesTags:(e,t,n)=>[{type:`Order`,id:`pending-${n}`},{type:`Order`,id:`LIST`}]})})}),x=(e,t)=>`https://api.salesapp.tenalidoublehorse.com/api/v1/orders/${e}/invoice/${t?`?company=${t}`:``}`;export{u as _,v as a,r as c,i as d,h as f,b as g,d as h,p as i,n as l,c as m,g as n,s as o,f as p,a as r,y as s,x as t,t as u,o as v};