"use strict";(()=>{var e={};e.id=3803,e.ids=[3803,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")},55775:(e,a,r)=>{r.r(a),r.d(a,{originalPathname:()=>k,patchFetch:()=>w,requestAsyncStorage:()=>m,routeModule:()=>p,serverHooks:()=>h,staticGenerationAsyncStorage:()=>l});var t={};r.r(t),r.d(t,{PATCH:()=>c});var s=r(49303),i=r(88716),n=r(60670),d=r(87070),o=r(72331);let u=o.prisma;async function c(e,{params:a}){try{let r=await e.json().catch(()=>({})),t=r.admin_username||"admin",s=r.note||"Ditolak oleh admin",i=await u.scoreReward.findUnique({where:{id:a.id}});if(!i)return d.NextResponse.json({success:!1,message:"Hadiah tidak ditemukan"},{status:404});if("pending"!==i.status)return d.NextResponse.json({success:!1,message:`Hadiah sudah berstatus ${i.status}`},{status:400});return await u.scoreReward.update({where:{id:a.id},data:{status:"rejected",approvedBy:t,approvedAt:new Date,note:s}}),await o.prisma.message.create({data:{threadId:`score-reward-rejected-${a.id}-${Date.now()}`,senderType:"system",recipientId:i.userId,subject:"❌ Hadiah Skor Tepat Ditolak",content:`Mohon maaf, hadiah skor tepat kamu untuk pertandingan:

🏆 ${i.matchInfo}

telah DITOLAK oleh admin.

Alasan: ${s}

Jika ada pertanyaan, silakan hubungi admin melalui menu Dukungan. Terima kasih.`}}).catch(()=>{}),d.NextResponse.json({success:!0,message:"Hadiah berhasil ditolak dan notifikasi dikirim ke user"})}catch(e){return console.error("Score reward reject error:",e),d.NextResponse.json({success:!1,message:"Gagal menolak hadiah"},{status:500})}}let p=new s.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/admin/score-rewards/[id]/reject/route",pathname:"/api/admin/score-rewards/[id]/reject",filename:"route",bundlePath:"app/api/admin/score-rewards/[id]/reject/route"},resolvedPagePath:"C:\\xampp\\htdocs\\Bolafest\\app\\api\\admin\\score-rewards\\[id]\\reject\\route.ts",nextConfigOutput:"standalone",userland:t}),{requestAsyncStorage:m,staticGenerationAsyncStorage:l,serverHooks:h}=p,k="/api/admin/score-rewards/[id]/reject/route";function w(){return(0,n.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:l})}},72331:(e,a,r)=>{r.d(a,{prisma:()=>s});var t=r(53524);let s=globalThis.prisma??new t.PrismaClient({log:["error"]})}};var a=require("../../../../../../webpack-runtime.js");a.C(e);var r=e=>a(a.s=e),t=a.X(0,[9276,5972],()=>r(55775));module.exports=t})();