import{t as e}from"./api-DAEUkJit.js";var t=[{type:`CustomerLedger`,id:`LIST`},{type:`CustomerCredit`,id:`LIST`},{type:`CreditAgeing`,id:`LIST`}],n=e.injectEndpoints({endpoints:e=>({listCustomerCredit:e.query({query:e=>({url:`/credit/customers/`,params:e||void 0}),providesTags:e=>e?[...e.results.map(({id:e})=>({type:`CustomerCredit`,id:e})),{type:`CustomerCredit`,id:`LIST`}]:[{type:`CustomerCredit`,id:`LIST`}]}),getCustomerCredit:e.query({query:e=>`/credit/customers/${e}/`,providesTags:(e,t,n)=>[{type:`CustomerCredit`,id:n}]}),setCreditTerms:e.mutation({query:({id:e,body:t})=>({url:`/credit/customers/${e}/set-limit/`,method:`PATCH`,body:t}),invalidatesTags:(e,n,{id:r})=>[{type:`CustomerCredit`,id:r},...t]}),creditAgeing:e.query({query:e=>({url:`/credit/customers/ageing/`,params:e||void 0}),providesTags:[{type:`CreditAgeing`,id:`LIST`}]}),creditStatement:e.query({query:({id:e,from:t,to:n})=>({url:`/credit/customers/${e}/statement/`,params:{...t?{from:t}:{},...n?{to:n}:{}}}),providesTags:(e,t,{id:n})=>[{type:`CustomerLedger`,id:n}]}),creditConfig:e.query({query:()=>`/credit/customers/config/`,providesTags:[{type:`CreditConfig`,id:`ALL`}]}),listLedger:e.query({query:e=>({url:`/credit/ledger/`,params:e||void 0}),providesTags:[{type:`CustomerLedger`,id:`LIST`}]}),createLedgerEntry:e.mutation({query:e=>({url:`/credit/ledger/`,method:`POST`,body:e}),invalidatesTags:t}),reverseLedgerEntry:e.mutation({query:({id:e,reason:t})=>({url:`/credit/ledger/${e}/reverse/`,method:`POST`,body:{reason:t}}),invalidatesTags:t})})}),r=e=>`https://api.salesapp.tenalidoublehorse.com/api/v1/credit/customers/${e}/statement/?pdf=1`,{useListCustomerCreditQuery:i,useGetCustomerCreditQuery:a,useSetCreditTermsMutation:o,useCreditAgeingQuery:s,useCreditStatementQuery:c,useCreditConfigQuery:l,useListLedgerQuery:u,useCreateLedgerEntryMutation:d,useReverseLedgerEntryMutation:f}=n;export{c as a,u as c,l as i,f as l,d as n,a as o,s as r,i as s,r as t,o as u};