const rateLimit = require("express-rate-limit");

function createPrintRateLimiter() {
  return rateLimit({
    windowMs: 60 * 1000,
    max: parseInt(process.env.PRINT_RATE_LIMIT || "120", 10) || 120,
    standardHeaders: true,
    legacyHeaders: false,
    message: { error: "RATE_LIMIT_EXCEEDED" },
    skip: (req) => req.method === "GET",
  });
}

module.exports = { createPrintRateLimiter };
