"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const Websocket_1=require("@b/handler/Websocket"),query_1=require("@b/utils/query");exports.metadata={summary:"Bulk updates the status of announcements",operationId:"bulkUpdateAnnouncementStatus",tags:["Admin","Announcements"],requestBody:{required:!0,content:{"application/json":{schema:{type:"object",properties:{ids:{type:"array",description:"Array of announcement IDs to update",items:{type:"string"}},status:{type:"boolean",description:"New status to apply to the announcements (true for active, false for inactive)"}},required:["ids","status"]}}}},responses:(0,query_1.updateRecordResponses)("Announcement"),requiresAuth:!0,permission:"edit.announcement",logModule:"ADMIN_SYS",logTitle:"Bulk update announcement status"};exports.default=async e=>{const{body:t,ctx:n}=e,{ids:s,status:a}=t;null==n||n.step(`Updating ${s.length} announcements to ${a?"active":"inactive"}`);const u=(0,query_1.updateStatus)("announcement",s,a);null==n||n.step("Broadcasting bulk status update");(0,Websocket_1.handleBroadcastMessage)({type:"announcements",model:"announcement",method:"update",status:a,id:s});null==n||n.success(`${s.length} announcement statuses updated successfully`);return u};