const dotenv = require("dotenv");
dotenv.config();

const CLIENT_ID = "4c12f36b-93d7-4fba-8342-2d7a1e55c87e";
const CLIENT_SECRET = "z8Fq@1vP!nH7gW3#bL9cR6xT$eK2jY0Z";

const authenticateClient = (req, res, next) => {
    const clientId = req.headers["client-id"];
    const clientSecret = req.headers["client-secret"];
  
    const validClientId = CLIENT_ID;
    const validClientSecret = CLIENT_SECRET;
  
    if (!clientId || !clientSecret) {
      return res.status(401).json({ message: "Missing client credentials" });
    }
  
    if (clientId !== validClientId || clientSecret !== validClientSecret) {
      return res.status(403).json({ message: "Invalid client credentials" });
    }
  
    next();
  };

module.exports = authenticateClient;
