"use strict";(()=>{var e={};e.id=9941,e.ids=[9941,2331],e.modules={53524:e=>{e.exports=require("@prisma/client")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},62863:(e,a,r)=>{r.r(a),r.d(a,{originalPathname:()=>v,patchFetch:()=>w,requestAsyncStorage:()=>m,routeModule:()=>c,serverHooks:()=>l,staticGenerationAsyncStorage:()=>h});var s={};r.r(s),r.d(s,{PATCH:()=>u});var t=r(49303),i=r(88716),n=r(60670),o=r(87070),d=r(72331);let p=d.prisma;async function u(e,{params:a}){try{let r=(await e.json().catch(()=>({}))).admin_username||"admin",s=await p.scoreReward.findUnique({where:{id:a.id}});if(!s)return o.NextResponse.json({success:!1,message:"Hadiah tidak ditemukan"},{status:404});if("pending"!==s.status)return o.NextResponse.json({success:!1,message:`Hadiah sudah berstatus ${s.status}`},{status:400});return await p.scoreReward.update({where:{id:a.id},data:{status:"approved",approvedBy:r,approvedAt:new Date}}),await d.prisma.message.create({data:{threadId:`score-reward-approved-${a.id}-${Date.now()}`,senderType:"system",recipientId:s.userId,subject:"✅ Hadiah Skor Tepat Disetujui!",content:`Selamat! Hadiah skor tepat kamu untuk pertandingan:

🏆 ${s.matchInfo}

telah DISETUJUI oleh admin.

💰 Hadiah Rp ${s.amount.toLocaleString("id-ID")} telah diisikan ke akun MPO777 kamu.

Terima kasih sudah bermain di Bolafest! Terus semangat menebak skor! 🎯`}}).catch(()=>{}),o.NextResponse.json({success:!0,message:"Hadiah berhasil disetujui dan notifikasi dikirim ke user"})}catch(e){return console.error("Score reward approve error:",e),o.NextResponse.json({success:!1,message:"Gagal menyetujui hadiah"},{status:500})}}let c=new t.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/admin/score-rewards/[id]/approve/route",pathname:"/api/admin/score-rewards/[id]/approve",filename:"route",bundlePath:"app/api/admin/score-rewards/[id]/approve/route"},resolvedPagePath:"C:\\xampp\\htdocs\\Bolafest\\app\\api\\admin\\score-rewards\\[id]\\approve\\route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:m,staticGenerationAsyncStorage:h,serverHooks:l}=c,v="/api/admin/score-rewards/[id]/approve/route";function w(){return(0,n.patchFetch)({serverHooks:l,staticGenerationAsyncStorage:h})}},72331:(e,a,r)=>{r.d(a,{prisma:()=>t});var s=r(53524);let t=globalThis.prisma??new s.PrismaClient({log:["error"]})}};var a=require("../../../../../../webpack-runtime.js");a.C(e);var r=e=>a(a.s=e),s=a.X(0,[9276,5972],()=>r(62863));module.exports=s})();