"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const error_1=require("@b/utils/error");exports.metadata={summary:"Get VAPID public key",description:"Returns the VAPID public key needed for Web Push subscription on the frontend",operationId:"getVapidPublicKey",tags:["User","Push Notifications"],requiresAuth:!0,responses:{200:{description:"VAPID public key retrieved successfully",content:{"application/json":{schema:{type:"object",properties:{publicKey:{type:"string",description:"VAPID public key for subscribing to push notifications"},fcmAvailable:{type:"boolean",description:"Whether FCM is configured (for mobile apps)"},webPushAvailable:{type:"boolean",description:"Whether Web Push (VAPID) is configured"}}}}}},401:{description:"Unauthorized"}}};exports.default=async e=>{const{user:s}=e;if(!(null==s?void 0:s.id))throw(0,error_1.createError)({statusCode:401,message:"User not authenticated"});const r=process.env.VAPID_PUBLIC_KEY||null,t=!(!process.env.FCM_PROJECT_ID&&!process.env.FCM_SERVICE_ACCOUNT_PATH),i=!(!process.env.VAPID_PUBLIC_KEY||!process.env.VAPID_PRIVATE_KEY);return r||t?{publicKey:r,fcmAvailable:t,webPushAvailable:i}:{publicKey:null,fcmAvailable:!1,webPushAvailable:!1,message:"Push notifications are not configured on this server"}};