import{b as f}from"./chunk-YYVE3SN6.js";import{a as o}from"./chunk-ZTKV4AIV.js";import{h as $}from"./chunk-73IMXZSJ.js";import{aa as r,ca as h,ha as m,i as g,na as u,u as c,v as a}from"./chunk-FWZCAEAJ.js";import{a as l,b as p}from"./chunk-CWTPBX7D.js";var O=(()=>{let i=class i{constructor(){this.url="/config/table",this.httpClient=u($),this.selectedEventService=u(f),this.triggerGet$=new g(!0)}getAll$(){return this.triggerGet$.pipe(r(()=>this.selectedEventService.selectedIdNotNull$),r(t=>a([this.httpClient.get(this.url,{params:{eventId:t}}),this.getTableIdsWithActiveOrders$(t)])),c(([t,e])=>t.map(s=>p(l({},s),{hasActiveOrders:e.tableIds.includes(s.id)}))))}getByParent$(t){return this.triggerGet$.pipe(r(()=>this.selectedEventService.selectedIdNotNull$),r(e=>a([this.httpClient.get(this.url,{params:{groupId:t}}),this.getTableIdsWithActiveOrders$(e)])),c(([e,s])=>e.map(d=>p(l({},d),{hasActiveOrders:s.tableIds.includes(d.id)}))))}getTableIdsWithActiveOrders$(t){return this.httpClient.get(`${this.url}/activeOrders`,{params:{eventId:t}})}getSingle$(t){return this.httpClient.get(`${this.url}/${o(t)}`)}create$(t){return this.httpClient.post(this.url,t).pipe(h(()=>this.triggerGet$.next(!0)))}update$(t){return this.httpClient.put(this.url,t).pipe(h(()=>this.triggerGet$.next(!0)))}delete$(t){return this.httpClient.delete(`${this.url}/${o(t)}`).pipe(h(()=>this.triggerGet$.next(!0)))}checkIfExists(t,e){return this.httpClient.get("/config/table/existsByGroupIdAndNumber",{params:{groupId:t,tableNumber:e}})}};i.\u0275fac=function(e){return new(e||i)},i.\u0275prov=m({token:i,factory:i.\u0275fac,providedIn:"root"});let n=i;return n})();export{O as a};
