"use strict";(()=>{var e={};e.id=9162,e.ids=[9162],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")},50986:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>v,patchFetch:()=>x,requestAsyncStorage:()=>l,routeModule:()=>d,serverHooks:()=>m,staticGenerationAsyncStorage:()=>h});var s={};t.r(s),t.d(s,{GET:()=>p,POST:()=>c});var a=t(49303),n=t(88716),o=t(60670),i=t(87070),u=t(72331);async function p(){try{let e=await u._.voucher.findMany({orderBy:{createdAt:"desc"},include:{_count:{select:{usages:!0}}}});return i.NextResponse.json(e)}catch(e){return i.NextResponse.json({error:"Failed to fetch vouchers"},{status:500})}}async function c(e){try{let{code:r,coins:t,vipDays:s,limit:a,expiresAt:n}=await e.json();if(!r)return i.NextResponse.json({error:"Code is required"},{status:400});let o=await u._.voucher.create({data:{code:r,coins:parseInt(t||"0"),vipDays:parseInt(s||"0"),limit:parseInt(a||"1"),expiresAt:n?new Date(n):null}});return i.NextResponse.json(o)}catch(e){return console.error(e),i.NextResponse.json({error:"Failed to create voucher"},{status:500})}}let d=new a.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/admin/vouchers/route",pathname:"/api/admin/vouchers",filename:"route",bundlePath:"app/api/admin/vouchers/route"},resolvedPagePath:"C:\\Users\\MSI\\Downloads\\film\\app\\api\\admin\\vouchers\\route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:l,staticGenerationAsyncStorage:h,serverHooks:m}=d,v="/api/admin/vouchers/route";function x(){return(0,o.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:h})}},72331:(e,r,t)=>{t.d(r,{_:()=>a});var s=t(53524);let a=global.prisma||new s.PrismaClient}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8948,5972],()=>t(50986));module.exports=s})();