"use strict";(()=>{var e={};e.id=3961,e.ids=[3961],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")},96739:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>w,patchFetch:()=>f,requestAsyncStorage:()=>g,routeModule:()=>m,serverHooks:()=>x,staticGenerationAsyncStorage:()=>v});var a={};t.r(a),t.d(a,{DELETE:()=>l,GET:()=>d,POST:()=>c});var n=t(49303),s=t(88716),i=t(60670),o=t(87070),p=t(72331);async function u(e){let{searchParams:r}=new URL(e.url),t=r.get("userId")||e.headers.get("x-user-id");if(!t)return!1;let a=await p._.user.findUnique({where:{id:t}});return a?.role==="ADMIN"}async function d(e){if(!await u(e))return o.NextResponse.json({error:"Unauthorized"},{status:401});let r=await p._.vipPackage.findMany({orderBy:{price:"asc"}});return o.NextResponse.json(r)}async function c(e){if(!await u(e))return o.NextResponse.json({error:"Unauthorized"},{status:401});let r=await e.json(),t={BRONZE:1,SILVER:2,GOLD:3,DIAMOND:4}[r.tier]||1,a=await p._.vipPackage.create({data:{name:r.name,days:parseInt(r.days),price:parseInt(r.price),coins:parseInt(r.coins||0),tier:r.tier||"BRONZE",level:t,description:r.description}});return o.NextResponse.json(a)}async function l(e){if(!await u(e))return o.NextResponse.json({error:"Unauthorized"},{status:401});let{searchParams:r}=new URL(e.url),t=r.get("id");return t?(await p._.vipPackage.delete({where:{id:t}}),o.NextResponse.json({success:!0})):o.NextResponse.json({error:"ID required"},{status:400})}let m=new n.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/admin/vip-packages/route",pathname:"/api/admin/vip-packages",filename:"route",bundlePath:"app/api/admin/vip-packages/route"},resolvedPagePath:"C:\\Users\\MSI\\Downloads\\film\\app\\api\\admin\\vip-packages\\route.ts",nextConfigOutput:"standalone",userland:a}),{requestAsyncStorage:g,staticGenerationAsyncStorage:v,serverHooks:x}=m,w="/api/admin/vip-packages/route";function f(){return(0,i.patchFetch)({serverHooks:x,staticGenerationAsyncStorage:v})}},72331:(e,r,t)=>{t.d(r,{_:()=>n});var a=t(53524);let n=global.prisma||new a.PrismaClient}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),a=r.X(0,[8948,5972],()=>t(96739));module.exports=a})();