import{c as n}from"./index-DiwDH9aE.js";import{a as o}from"./multiUserApiClient-CKPzIhIr.js";/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const s=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],p=n("square-pen",s);class h{constructor(e){if(!e||typeof e!="string")throw new Error("BaseService requiere un endpoint");this.endpoint=e}async getAll(e={}){try{return await o.get(this.endpoint,{params:e})}catch(r){throw console.error(`[BaseService] Error en getAll (${this.endpoint}):`,r),r}}async getById(e,r={}){try{if(!e)throw new Error("ID es requerido para getById()");return await o.get(`${this.endpoint}/${e}`,{params:r})}catch(t){throw console.error(`[BaseService] Error en getById (${this.endpoint}/${e}):`,t),t}}async create(e){try{if(!e||Object.keys(e).length===0)throw new Error("Data es requerido para create()");return await o.post(this.endpoint,e)}catch(r){throw console.error(`[BaseService] Error en create (${this.endpoint}):`,r),r}}async update(e,r){try{if(!e)throw new Error("ID es requerido para update()");if(!r||Object.keys(r).length===0)throw new Error("Data es requerido para update()");return await o.put(`${this.endpoint}/${e}`,r)}catch(t){throw console.error(`[BaseService] Error en update (${this.endpoint}/${e}):`,t),t}}async delete(e){try{if(!e)throw new Error("ID es requerido para delete()");return await o.delete(`${this.endpoint}/${e}`)}catch(r){throw console.error(`[BaseService] Error en delete (${this.endpoint}/${e}):`,r),r}}}export{h as B,p as S};
