const jwt = require("jsonwebtoken");
const jwbToken = (user) => {
  const token = jwt.sign(
    {
      rank: user.rank,
      cadre: user.cadre,
      branch_id: user.branch_id,
      email: user.email,
    },
    process.env.jwt_sec
  );

  return token;
};

const jwbToken1 = (user) => {
  const token = jwt.sign(
    {
      rank: user.rank,
      cadre: user.cadre,
      branch_id: user.branch_id,
      email: user.email,
      phoneNumber: user.phoneNumber,
    },
    process.env.jwt_sec1,
    { expiresIn: "8h" }
  );
  return token;
};

module.exports = { jwbToken, jwbToken1 };
