"use strict";(()=>{var e={};e.id=87,e.ids=[87],e.modules={53524:e=>{e.exports=require("@prisma/client")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},32081:e=>{e.exports=require("child_process")},6113:e=>{e.exports=require("crypto")},9523:e=>{e.exports=require("dns")},82361:e=>{e.exports=require("events")},57147:e=>{e.exports=require("fs")},13685:e=>{e.exports=require("http")},95687:e=>{e.exports=require("https")},41808:e=>{e.exports=require("net")},22037:e=>{e.exports=require("os")},71017:e=>{e.exports=require("path")},12781:e=>{e.exports=require("stream")},24404:e=>{e.exports=require("tls")},57310:e=>{e.exports=require("url")},73837:e=>{e.exports=require("util")},59796:e=>{e.exports=require("zlib")},19012:(e,r,t)=>{t.r(r),t.d(r,{headerHooks:()=>A,originalPathname:()=>E,requestAsyncStorage:()=>P,routeModule:()=>c,serverHooks:()=>q,staticGenerationAsyncStorage:()=>x,staticGenerationBailout:()=>h});var o={};t.r(o),t.d(o,{DELETE:()=>d,PATCH:()=>p}),t(95655);var s=t(83323),i=t(54647),a=t(66886),u=t(30953),n=t(82280);async function d(e,{params:r}){try{let{id:e}=r,t=await u._.order.findUnique({where:{id:e}});if(!t)return a.Z.json({error:"Order not found"},{status:404});await u._.orderItem.deleteMany({where:{orderId:e}});let o=await u._.order.delete({where:{id:e}});return a.Z.json(o)}catch(e){return console.error("Error deleting order:",e),a.Z.json({error:"Error deleting order"},{status:500})}}async function p(e,{params:r}){try{let{id:t}=r,o=await e.json(),{status:s}=o;if(!s)return a.Z.json({error:"Status is required"},{status:400});let i=await u._.order.update({where:{id:t},data:{status:s},include:{items:{include:{product:!0,variant:!0}}}});return(async()=>{try{await n.y.sendOrderStatusUpdate(i)}catch(e){console.error("Failed to send status update email",e)}})(),a.Z.json(i)}catch(e){return console.error("Error updating order:",e),a.Z.json({error:"Error updating order"},{status:500})}}let l=s.AppRouteRouteModule,c=new l({definition:{kind:i.x.APP_ROUTE,page:"/api/orders/[id]/route",pathname:"/api/orders/[id]",filename:"route",bundlePath:"app/api/orders/[id]/route"},resolvedPagePath:".\\app\\api\\orders\\[id]\\route.ts",nextConfigOutput:"standalone",userland:o}),{requestAsyncStorage:P,staticGenerationAsyncStorage:x,serverHooks:q,headerHooks:A,staticGenerationBailout:h}=c,E="/api/orders/[id]/route"},54647:(e,r)=>{var t;Object.defineProperty(r,"x",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE"}(t||(t={}))}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),o=r.X(0,[9727,3497,6886,3330,2280],()=>t(19012));module.exports=o})();