/**
 * Middleware na validáciu accountId parametra
 * Kontroluje query alebo body a nastaví req.accountId
 */
export const requireAccountId = (req, res, next) => {
  const accountId = req.query.accountId || req.body.accountId;

  if (!accountId) {
    return res.status(400).json({
      success: false,
      error: {
        message: 'accountId je povinný parameter',
        statusCode: 400,
      },
    });
  }

  req.accountId = accountId;
  next();
};
