import{P as d,Q as i,x as l,R as p}from"./YTYhyFR4.js";const a=p(),c=d({id:"pools-store",state:()=>({loadingPools:!1,loadingPayments:!1,pools:[],pool:{},count:{},loadingCount:!1,results:[],countP:{},guessId:0,payments:[],paymentTicket:{},pdf:{},token:"",pool_numbers:[]}),actions:{async getCount(){const{data:n,pending:o}=await i(`${a.public.api}/quinielas/contador`,{method:"GET",headers:{"Content-Type":"application/json","Allow-Control-Allow-Origin":"*"}},"$9DsF4HYlXj");this.loadingCount=o,n.value&&(this.count=n.value)},async updateCount(n,o){const{data:t,pending:e}=await i(`${a.public.api}/quinielas/actualizar/contador`,{method:"PUT",headers:{"Content-Type":"application/json","Allow-Control-Allow-Origin":"*"},body:JSON.stringify({ID:n,NUMERO_QUINIELA:o})},"$wClqYtlFlm");this.loadingCount=e,t.value},async createPools(n){const o=l("token");this.token=o.value||"";const{data:t,pending:e}=await i(`${a.public.api}/quinielas/nueva`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`App${this.token}`},body:JSON.stringify(n)},"$g5eD8pMfFx");this.loadingPools=e,t.value},async getCurrentPool(n){const{data:o,pending:t}=await i(`${a.public.api}/quinielas/quiniela/${n}`,{method:"GET",headers:{"Content-Type":"application/json","Allow-Control-Allow-Origin":"*"}},"$8D8FzzAkDk");this.loadingPools=t,o.value&&(this.pool=o.value.body)},async userPrediction(n){const{data:o,pending:t}=await i(`${a.public.api}/prediccion/nueva`,{method:"POST",headers:{"Content-Type":"application/json","Allow-Control-Allow-Origin":"*"},body:JSON.stringify(n)},"$ECKAQHb7mU");this.loadingPools=t,o.value},async createCounterPool(n){try{const{data:o,pending:t}=await i(`${a.public.api}/prediccion/nuevo/contador`,{method:"POST",headers:{"Content-Type":"application/json","Allow-Control-Allow-Origin":"*"},body:JSON.stringify({NUMERO_QUINIELA:n})},"$kqCst6v7Gv");this.loadingPools=t,o.value}catch(o){console.error("Error fetching data: ",o)}},async getCountPrediction(n){const{data:o,pending:t}=await i(`${a.public.api}/prediccion/contador/${n}`,{method:"GET",headers:{"Content-Type":"application/json","Allow-Control-Allow-Origin":"*"}},"$sOo3T3unDj");this.loadingCount=t,o.value&&(this.countP=o.value)},async updateCountPrediction(n,o){const{data:t,pending:e}=await i(`${a.public.api}/prediccion/actualizar/contador`,{method:"PUT",headers:{"Content-Type":"application/json","Allow-Control-Allow-Origin":"*"},body:JSON.stringify({ID:n,CONTADOR:o})},"$Qerf12RUpH");this.loadingCount=e,t.value},async registerUserGuess(n){const{data:o,pending:t}=await i(`${a.public.api}/invitados/nuevo`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},"$PPEgK9vJUi");if(this.loadingPools=t,o.value)return this.guessId=o.value.body.insertId,this.guessId;throw new Error("Failed to register user guess")},async poolResult(n){const o=l("token");this.token=o.value||"";const{data:t,pending:e}=await i(`${a.public.api}/quinielas/actualizar/resultados`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`App${this.token}`},body:JSON.stringify(n)},"$T85XI2JEFt");this.loadingPools=e,t.value},async getPoolResults(n){const{data:o,pending:t}=await i(`${a.public.api}/prediccion/resultados/${n}`,{method:"GET",headers:{"Content-Type":"application/json","Allow-Control-Allow-Origin":"*"}},"$u3WkFi3nYg");this.loadingPools=t,o.value&&(this.results=o.value.body)},async getPoolsNumber(){const{data:n,pending:o}=await i(`${a.public.api}/quinielas/numeros`,{method:"GET",headers:{"Content-Type":"application/json","Allow-Control-Allow-Origin":"*"}},"$YJefn67zqO");this.loadingPools=o,n.value&&(this.pool_numbers=n.value.body)},async getPendingPayment(n){const{data:o,pending:t}=await i(`${a.public.api}/pagos/pendientes/${n}`,{method:"GET",headers:{"Content-Type":"application/json","Allow-Control-Allow-Origin":"*"}},"$BmTj6RIS72");this.loadingPayments=t,o.value&&(this.payments=o.value.body)},async updatePaymentStatus(n,o,t){const{data:e,pending:s}=await i(`${a.public.api}/pagos/actualizar`,{method:"PUT",headers:{"Content-Type":"application/json","Allow-Control-Allow-Origin":"*"},body:JSON.stringify({ID:n,PAGADO:o,FECHA_PAGO:t})},"$GnNnqsWIdz");this.loadingPayments=s,e.value},async getTicket(n){const{data:o,pending:t}=await i(`${a.public.api}/pagos/pdf/${n}`,{method:"GET",headers:{"Content-Type":"application/json","Allow-Control-Allow-Origin":"*"}},"$XgNiMCbWHc");this.loadingPayments=t,o.value&&(this.paymentTicket=o.value)},async getBlankPdf(n){const{data:o,pending:t}=await i(`${a.public.api}/quinielas/pdf/${n}`,{method:"GET",headers:{"Content-Type":"application/json","Allow-Control-Allow-Origin":"*"}},"$c0rF6aeBkN");this.loadingPayments=t,o.value&&(this.pdf=o.value)}}});export{c as u};
