"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const notification_1=require("@b/services/notification");exports.metadata={summary:"Remove Device Token",description:"Unregister a device token for push notifications",operationId:"removeDeviceToken",tags:["User","Notifications","Device Token"],requiresAuth:!0,requestBody:{content:{"application/json":{schema:{type:"object",properties:{token:{type:"string",description:"The device token to remove"},deviceId:{type:"string",description:"The device ID to remove"}}}}}},responses:{200:{description:"Device token removed successfully",content:{"application/json":{schema:{type:"object",properties:{message:{type:"string"}}}}}},401:{description:"Unauthorized"},400:{description:"Bad Request - Device token or device ID is required"}}};exports.default=async e=>{const{user:o,body:t}=e;if(!(null==o?void 0:o.id))throw new Error("Unauthorized");const{token:i,deviceId:r}=t;if(!i&&!r)throw new Error("Device token or device ID is required");return await(0,notification_1.removeDeviceToken)(o.id,i||r)?{message:"Device token removed successfully"}:{message:"Device token not found or already removed"}};