import axios from "axios";

/**
 * Fetch guilds/owners list for PSP POS devices
 * @param {string} role - The role from URL
 * @returns {Promise} Axios promise with guilds data
 */
export const fetchPspGuilds = async (role) => {
  const response = await axios.get(
    `/guilds/?role=${role}&page_size=1000&psp_pos=true`
  );
  return response;
};

/**
 * Fetch kill houses list for PSP POS devices
 * @returns {Promise} Axios promise with kill houses data
 */
export const fetchPspKillHouses = async () => {
  const response = await axios.get(`/kill_house/?psp=true`);
  return response;
};

/**
 * Update POS machine owner
 * @param {Object} payload - The payload containing device key, owner type, and owner key
 * @returns {Promise} Axios promise with update response
 */
export const updatePosMachineOwner = async (payload) => {
  const response = await axios.put(`/new-pos-machine/0/`, payload);
  return response;
};
