(()=>{var e={};e.id=5505,e.ids=[5505],e.modules={3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},9455:(e,r,t)=>{"use strict";t.r(r),t.d(r,{patchFetch:()=>g,routeModule:()=>f,serverHooks:()=>h,workAsyncStorage:()=>k,workUnitAsyncStorage:()=>v});var s={};t.r(s),t.d(s,{GET:()=>m});var i=t(96559),n=t(48088),o=t(37719),a=t(32190),u=t(43205),c=t.n(u),p=t(96330),d=t(12909);let l=new p.PrismaClient,x=(0,d.u)();async function m(e,{params:r}){try{let t,s=(0,d.V)(e);if(!s)return a.NextResponse.json({error:"Unauthorized"},{status:401});try{t=c().verify(s,x)}catch{return a.NextResponse.json({error:"Invalid token"},{status:401})}if(!t.userId)return a.NextResponse.json({error:"Unauthorized"},{status:401});let i=await Promise.resolve(r),n=parseInt(i.id);if(isNaN(n))return a.NextResponse.json({error:"Invalid ticket ID"},{status:400});let o=await l.ticket.findFirst({where:{id:n,userId:t.userId},include:{messages:{orderBy:{createdAt:"asc"},include:{user:{select:{name:!0,surname:!0,email:!0}},globalAdmin:{select:{name:!0,surname:!0,email:!0}}}},user:{select:{name:!0,surname:!0,email:!0}}}});if(!o)return a.NextResponse.json({error:"Ticket not found"},{status:404});return a.NextResponse.json({ticket:o})}catch(e){return console.error("Get ticket error:",e),a.NextResponse.json({error:"Server error"},{status:500})}finally{await l.$disconnect()}}let f=new i.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/tickets/[id]/route",pathname:"/api/tickets/[id]",filename:"route",bundlePath:"app/api/tickets/[id]/route"},resolvedPagePath:"/Users/mustafaseyhan/Project/PazarAnalist/src/app/api/tickets/[id]/route.ts",nextConfigOutput:"standalone",userland:s}),{workAsyncStorage:k,workUnitAsyncStorage:v,serverHooks:h}=f;function g(){return(0,o.patchFetch)({workAsyncStorage:k,workUnitAsyncStorage:v})}},10846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12909:(e,r,t)=>{"use strict";function s(){let e=process.env.JWT_SECRET;if(!e)throw Error("JWT_SECRET is not set");return e}function i(e){let r=e.headers.get("authorization");if(r&&r.startsWith("Bearer "))return r.slice(7);let t=e.cookies.get("admin_token")?.value;if(t)return t;let s=e.cookies.get("token")?.value;return s||null}t.d(r,{V:()=>i,u:()=>s})},27910:e=>{"use strict";e.exports=require("stream")},28354:e=>{"use strict";e.exports=require("util")},29294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:e=>{"use strict";e.exports=require("crypto")},63033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},79428:e=>{"use strict";e.exports=require("buffer")},96330:e=>{"use strict";e.exports=require("@prisma/client")},96487:()=>{}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[4447,580,3205],()=>t(9455));module.exports=s})();