import{t as e}from"./api-DqXJkjY6.js";var{useListCustomersQuery:t,useGetCustomerQuery:n,useCreateCustomerMutation:r,useUpdateCustomerMutation:i,useDeleteCustomerMutation:a,useListAddressesQuery:o,useCreateAddressMutation:s,useDeleteAddressMutation:c,useListGuarantorsQuery:l,useAddGuarantorMutation:u,useRemoveGuarantorMutation:d}=e.injectEndpoints({endpoints:e=>({listCustomers:e.query({query:e=>({url:`/customers/`,params:e||void 0}),providesTags:e=>e?[...e.results.map(({id:e})=>({type:`Customer`,id:e})),{type:`Customer`,id:`LIST`}]:[{type:`Customer`,id:`LIST`}]}),getCustomer:e.query({query:e=>`/customers/${e}/`,providesTags:(e,t,n)=>[{type:`Customer`,id:n}]}),createCustomer:e.mutation({query:e=>({url:`/customers/`,method:`POST`,body:e}),invalidatesTags:[{type:`Customer`,id:`LIST`}]}),updateCustomer:e.mutation({query:({id:e,body:t})=>({url:`/customers/${e}/`,method:`PATCH`,body:t}),invalidatesTags:(e,t,{id:n})=>[{type:`Customer`,id:n},{type:`Customer`,id:`LIST`}]}),deleteCustomer:e.mutation({query:e=>({url:`/customers/${e}/`,method:`DELETE`}),invalidatesTags:(e,t,n)=>[{type:`Customer`,id:n},{type:`Customer`,id:`LIST`}]}),listAddresses:e.query({query:e=>`/customers/${e}/addresses/`,providesTags:(e,t,n)=>e?[...e.map(({id:e})=>({type:`CustomerAddress`,id:e})),{type:`CustomerAddress`,id:`LIST-${n}`}]:[{type:`CustomerAddress`,id:`LIST-${n}`}]}),createAddress:e.mutation({query:({customerId:e,body:t})=>({url:`/customers/${e}/addresses/`,method:`POST`,body:t}),invalidatesTags:(e,t,{customerId:n})=>[{type:`CustomerAddress`,id:`LIST-${n}`}]}),deleteAddress:e.mutation({query:({customerId:e,addressId:t})=>({url:`/customers/${e}/addresses/${t}/`,method:`DELETE`}),invalidatesTags:(e,t,{customerId:n,addressId:r})=>[{type:`CustomerAddress`,id:r},{type:`CustomerAddress`,id:`LIST-${n}`}]}),listGuarantors:e.query({query:e=>`/customers/${e}/guarantors/`,providesTags:(e,t,n)=>e?[...e.map(({id:e})=>({type:`CustomerGuarantor`,id:e})),{type:`CustomerGuarantor`,id:`LIST-${n}`},{type:`Customer`,id:n}]:[{type:`CustomerGuarantor`,id:`LIST-${n}`},{type:`Customer`,id:n}]}),addGuarantor:e.mutation({query:({customerId:e,body:t})=>({url:`/customers/${e}/guarantors/`,method:`POST`,body:t}),invalidatesTags:(e,t,{customerId:n})=>[{type:`CustomerGuarantor`,id:`LIST-${n}`},{type:`Customer`,id:`LIST`}]}),removeGuarantor:e.mutation({query:({customerId:e,guarantorId:t})=>({url:`/customers/${e}/guarantors/${t}/`,method:`DELETE`}),invalidatesTags:(e,t,{customerId:n,guarantorId:r})=>[{type:`CustomerGuarantor`,id:r},{type:`CustomerGuarantor`,id:`LIST-${n}`},{type:`Customer`,id:`LIST`}]})})});export{a,t as c,i as d,c as i,l,s as n,n as o,r,o as s,u as t,d as u};