'use strict'; const AppError = require('../../utils/AppError'); const assertCanResetPasswordAndSms = (user) => { if (!user) throw new AppError('USER_NOT_FOUND'); const phoneNumber = String(user.phoneNumber || user.phone || '').trim(); const username = String(user.username || '').trim(); const name = String(user.name || '').trim(); if (!phoneNumber) throw new AppError('PHONE_NUMBER_REQUIRED'); if (!username) throw new AppError('VALIDATION_FAILED', null, 'Username is missing'); return { username, phoneNumber, name }; }; const isCredentialsSmsDelivered = (sendResult) => { if (!sendResult) return false; return sendResult.result?.skipped !== true; }; module.exports = { assertCanResetPasswordAndSms, isCredentialsSmsDelivered };