"use strict";(()=>{var e={};e.id=1777,e.ids=[1777,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")},55508:(e,o,s)=>{s.r(o),s.d(o,{originalPathname:()=>g,patchFetch:()=>x,requestAsyncStorage:()=>m,routeModule:()=>c,serverHooks:()=>h,staticGenerationAsyncStorage:()=>l});var r={};s.r(r),s.d(r,{DELETE:()=>u,PATCH:()=>p});var t=s(49303),a=s(88716),i=s(60670),d=s(87070);let n=s(72331).prisma;async function p(e,{params:o}){try{let{is_active:s}=await e.json(),r=await n.promoCode.findUnique({where:{id:o.id}});if(!r)return d.NextResponse.json({success:!1,message:"Kode promo tidak ditemukan"},{status:404});let t=await n.promoCode.update({where:{id:o.id},data:{isActive:"boolean"==typeof s?s:r.isActive}});return d.NextResponse.json({success:!0,message:`Kode promo ${t.isActive?"diaktifkan":"dinonaktifkan"}`,data:{id:t.id,code:t.code,is_active:t.isActive}})}catch(e){return console.error("Admin promo code PATCH error:",e),d.NextResponse.json({success:!1,message:"Gagal memperbarui kode promo"},{status:500})}}async function u(e,{params:o}){try{let e=await n.promoCode.findUnique({where:{id:o.id}});if(!e)return d.NextResponse.json({success:!1,message:"Kode promo tidak ditemukan"},{status:404});return await n.promoCode.delete({where:{id:o.id}}),d.NextResponse.json({success:!0,message:`Kode promo ${e.code} berhasil dihapus`})}catch(e){return console.error("Admin promo code DELETE error:",e),d.NextResponse.json({success:!1,message:"Gagal menghapus kode promo"},{status:500})}}let c=new t.AppRouteRouteModule({definition:{kind:a.x.APP_ROUTE,page:"/api/admin/promo-codes/[id]/route",pathname:"/api/admin/promo-codes/[id]",filename:"route",bundlePath:"app/api/admin/promo-codes/[id]/route"},resolvedPagePath:"C:\\xampp\\htdocs\\Bolafest\\app\\api\\admin\\promo-codes\\[id]\\route.ts",nextConfigOutput:"standalone",userland:r}),{requestAsyncStorage:m,staticGenerationAsyncStorage:l,serverHooks:h}=c,g="/api/admin/promo-codes/[id]/route";function x(){return(0,i.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:l})}},72331:(e,o,s)=>{s.d(o,{prisma:()=>t});var r=s(53524);let t=globalThis.prisma??new r.PrismaClient({log:["error"]})}};var o=require("../../../../../webpack-runtime.js");o.C(e);var s=e=>o(o.s=e),r=o.X(0,[9276,5972],()=>s(55508));module.exports=r})();