const axios = require("axios");

const createWordPressUser = async (username, email, password) => {
  const wpApiUrl = "https://ai.pcc.co.il/wp-json/wp/v2/users";
  const wpApiCredentials = Buffer.from(
    "aramainfo@gmail.com:ofjG 02fW rEnl vtIa qMXJ XdUU"
  ).toString("base64");

  return await axios.post(
    wpApiUrl,
    {
      username: username,
      email: email,
      password: password,
    },
    {
      headers: {
        Authorization: `Basic ${wpApiCredentials}`,
      },
    }
  );
};

module.exports = {
  createWordPressUser,
};
