"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const query_1=require("@b/utils/query"),utils_1=require("../utils");exports.metadata={summary:"Updates an existing wallet",operationId:"updateWallet",tags:["Admin","Wallets"],parameters:[{index:0,name:"id",in:"path",description:"The ID of the wallet to update",required:!0,schema:{type:"string"}}],requestBody:{required:!0,description:"Updated data for the wallet",content:{"application/json":{schema:utils_1.walletUpdateSchema}}},responses:(0,query_1.updateRecordResponses)("Wallet"),requiresAuth:!0,permission:"edit.wallet",logModule:"ADMIN_FIN",logTitle:"Update Wallet"};exports.default=async e=>{const{body:t,params:a,ctx:s}=e,{id:r}=a,{type:d,currency:l,balance:i,inOrder:o,status:u}=t,n={};void 0!==d&&(n.type=d);void 0!==l&&(n.currency=l);void 0!==i&&(n.balance=i);void 0!==o&&(n.inOrder=o);void 0!==u&&(n.status=u);const p=await(0,query_1.updateRecord)("wallet",r,n);null==s||s.success("Wallet updated successfully");return p};