import{cc as c,db as _,eb as u,ec as p,k as i,q as s,t as d}from"./chunk-BYJPVSLE.js";var n=class{constructor(){this.status="Processing",this.booking_amount=0,this.card_id="",this.txn_id=""}static toFormData(e){let t=new FormData;return e.id&&t.append("id",e.id),e.customer_id&&t.append("customer_id",e.customer_id),e.restaurant_id&&t.append("restaurant_id",e.restaurant_id),e.booking_id&&t.append("booking_id",e.booking_id),e.customer_name&&t.append("customer_name",e.customer_name),e.guest_count&&t.append("guest_count",e.guest_count),e.booking_email&&t.append("booking_email",e.booking_email),e.booking_phone&&t.append("booking_phone",e.booking_phone),e.booking_instruction&&t.append("booking_instruction",e.booking_instruction),e.booking_date&&t.append("booking_date",e.booking_date),e.booking_time&&t.append("booking_time",e.booking_time),e.status&&t.append("status",e.status),e.type&&t.append("type",e.type),e.cancel_reason&&t.append("cancel_reason",e.cancel_reason),e.booking_amount&&t.append("booking_amount",e.booking_amount.toString()),e.card_id&&t.append("card_id",e.card_id),e.txn_id&&t.append("txn_id",e.txn_id),t}};var y=(()=>{class a{constructor(t){this.http=t,this.url=c.apiBaseUrl+"bookings/",this.carts=[]}get(t={}){let r=new _;return t.page&&(r=r.set("page",t.page)),t.per_page&&(r=r.set("per_page",t.per_page)),t.customer_id&&(r=r.set("customer_id",t.customer_id)),t.restaurant_id&&(r=r.set("restaurant_id",t.restaurant_id)),t.nopaginate&&(r=r.set("nopaginate",t.nopaginate)),this.http.get(`${this.url}`,{params:r}).pipe(i(p.handleError))}show(t){return this.http.get(this.url+t).pipe(i(p.handleError))}create(t){return this.http.post(this.url,n.toFormData(t)).pipe(i(p.handleError))}update(t){return this.http.post(this.url+t.id,n.toFormData(t)).pipe(i(p.handleError))}delete(t){return this.http.delete(this.url+t).pipe(i(p.handleError))}static{this.\u0275fac=function(r){return new(r||a)(d(u))}}static{this.\u0275prov=s({token:a,factory:a.\u0275fac,providedIn:"root"})}}return a})();export{n as a,y as b};
